[gnumeric] solver: be paranoid about error values.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] solver: be paranoid about error values.
- Date: Tue, 25 May 2010 02:32:30 +0000 (UTC)
commit 0fa21f70746966b49d461e32d4154446cf2add30
Author: Morten Welinder <terra gnome org>
Date: Mon May 24 22:31:31 2010 -0400
solver: be paranoid about error values.
src/tools/ChangeLog | 5 +++++
src/tools/gnm-solver.c | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 358dbe2..8641c41 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-24 Morten Welinder <terra gnome org>
+
+ * src/tools/gnm-solver.c (gnm_solver_check_constraints): Check
+ that the objective value is a number.
+
2010-05-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* analysis-wilcoxon-mann-whitney.c: new
diff --git a/src/tools/gnm-solver.c b/src/tools/gnm-solver.c
index 43a9dd4..79dbed8 100644
--- a/src/tools/gnm-solver.c
+++ b/src/tools/gnm-solver.c
@@ -961,6 +961,7 @@ gnm_solver_check_constraints (GnmSolver *solver)
{
GSList *l;
GnmSolverParameters *sp = solver->params;
+ GnmCell *target_cell;
if (sp->options.assume_non_negative ||
sp->options.assume_discrete) {
@@ -1026,6 +1027,11 @@ gnm_solver_check_constraints (GnmSolver *solver)
}
}
+ target_cell = gnm_solver_param_get_target_cell (sp);
+ gnm_cell_eval (target_cell);
+ if (!target_cell || !VALUE_IS_NUMBER (target_cell->value))
+ return FALSE;
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]