Commit 8be2ddb2 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Properly check that the constraint sides are not empty. Fixes #314025.

2005-08-22  Morten Welinder  <terra@gnome.org>

	* solver.c (lp_qp_solver_init): Properly check that the constraint
	sides are not empty.  Fixes #314025.
parent b2725b87
Gnumeric 1.5.4
Jean Brefort:
* Fix #313463.
* Fix crash on close related to graph plugins. [#313463]
Morten:
* Fix harmless, but ugly, error message on xls save.
* Fix solver crash. [#314025]
--------------------------------------------------------------------------
Gnumeric 1.5.3
......
2005-08-22 Morten Welinder <terra@gnome.org>
* solver.c (lp_qp_solver_init): Properly check that the constraint
sides are not empty. Fixes #314025.
2005-08-15 Morten Welinder <terra@gnome.org>
* Release 1.5.3
......
......@@ -385,19 +385,22 @@ lp_qp_solver_init (Sheet *sheet, const SolverParameters *param,
for (i = ind = 0; i < param->n_total_constraints; i++) {
SolverConstraint const *c = solver_get_constraint (res, i);
GTimeVal cur_time;
const GnmValue *val;
target = sheet_cell_get (sheet, c->lhs.col, c->lhs.row);
cell_eval (target);
if (target) {
cell_eval (target);
val = target->value;
} else
val = NULL;
/* Check that LHS is a number type. */
if (! (target->value == NULL ||
VALUE_IS_EMPTY (target->value) ||
VALUE_IS_NUMBER (target->value))) {
*errmsg = _("The LHS cells should contain formulas "
"that yield proper numerical values. "
"Specify valid LHS entries.");
solver_results_free (res);
return NULL;
if (val == NULL || !VALUE_IS_NUMBER (val)) {
*errmsg = _("The LHS cells should contain formulas "
"that yield proper numerical values. "
"Specify valid LHS entries.");
solver_results_free (res);
return NULL;
}
if (c->type == SolverINT) {
......@@ -427,18 +430,21 @@ lp_qp_solver_init (Sheet *sheet, const SolverParameters *param,
res->constr_coeff[i][n] = x;
}
}
target = sheet_cell_get (sheet, c->rhs.col, c->rhs.row);
cell_eval (target);
if (target) {
cell_eval (target);
val = target->value;
} else
val = NULL;
/* Check that RHS is a number type. */
if (! (target->value == NULL ||
VALUE_IS_EMPTY (target->value) ||
VALUE_IS_NUMBER (target->value))) {
*errmsg = _("The RHS cells should contain proper "
"numerical values only. Specify valid "
"RHS entries.");
solver_results_free (res);
return NULL;
if (val == NULL || !VALUE_IS_NUMBER (val)) {
*errmsg = _("The RHS cells should contain proper "
"numerical values only. Specify valid "
"RHS entries.");
solver_results_free (res);
return NULL;
}
x = value_get_as_float (target->value) - base;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment