Skip to content

Commit 5c7841a

Browse files
committed
Added error checking in equation editor.
1 parent 4a006b5 commit 5c7841a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

FEBioStudio/DlgFormula.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,20 @@ std::vector<vec2d> CDlgFormula::GetPoints()
140140
std::vector<vec2d> pts;
141141
MSimpleExpression m;
142142
MVariable* tvar = m.AddVariable("t");
143-
m.Create(smath);
144-
for (int i = 0; i<samples; ++i)
143+
bool b = m.Create(smath);
144+
if (b == false)
145145
{
146-
double x = fmin + i*(fmax - fmin) / (samples - 1);
147-
tvar->value(x);
148-
double y = m.value();
149-
pts.push_back(vec2d(x, y));
146+
QMessageBox::critical(this, "Equation editor", "Error in expression.");
147+
}
148+
else
149+
{
150+
for (int i = 0; i < samples; ++i)
151+
{
152+
double x = fmin + i * (fmax - fmin) / (samples - 1);
153+
tvar->value(x);
154+
double y = m.value();
155+
pts.push_back(vec2d(x, y));
156+
}
150157
}
151158

152159
return pts;

0 commit comments

Comments
 (0)