From e6fec099052ccbb383d5092e81cb47a7626a6f5c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 29 Sep 2015 18:09:41 +0300 Subject: [PATCH] Fixed issue #379. Crash in Tape, Create/Edit when '(' in Formula field then click f(x). --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 1c465c976..df6b6961c 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -786,7 +786,15 @@ void TMainWindow::Fx() QString text = ui->plainTextEditFormula->toPlainText(); text.replace("\n", " "); - text = qApp->TrVars()->FormulaFromUser(text, true); + try + { + text = qApp->TrVars()->FormulaFromUser(text, true); + } + catch (qmu::QmuParserError &e) // Just in case something bad will happen + { + Q_UNUSED(e) + text = ui->plainTextEditFormula->toPlainText(); + } dialog->SetFormula(text); const QString postfix = VDomDocument::UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch) dialog->setPostfix(postfix); @@ -1229,7 +1237,7 @@ void TMainWindow::SaveMValue() const QString formula = qApp->TrVars()->FormulaFromUser(text, true); m->SetMValue(nameField->data(Qt::UserRole).toString(), formula); } - catch (qmu::QmuParserError &e) // Just in case something bad happens + catch (qmu::QmuParserError &e) // Just in case something bad will happen { Q_UNUSED(e) return;