From 6e0ff89b6a742329165e77672cad27c7931cb58f Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 22 Nov 2014 14:49:09 +0200 Subject: [PATCH] Additional checkings. --HG-- branch : develop --- src/app/container/calculator.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/container/calculator.cpp b/src/app/container/calculator.cpp index 6d04df791..175ec14a3 100644 --- a/src/app/container/calculator.cpp +++ b/src/app/container/calculator.cpp @@ -31,6 +31,7 @@ #include #include "../core/vapplication.h" #include "vcontainer.h" +#include "../core/vsettings.h" using namespace qmu; @@ -52,6 +53,7 @@ using namespace qmu; Calculator::Calculator(const VContainer *data) :QmuParser(), vVarVal(nullptr), data(data) { + SCASSERT(data != nullptr) InitCharacterSets(); setAllowSubexpressions(false);//Only one expression per time @@ -88,6 +90,7 @@ Calculator::Calculator(const QString &formula, bool fromUser) Eval(); } +//--------------------------------------------------------------------------------------------------------------------- Calculator::~Calculator() { delete [] vVarVal; @@ -112,7 +115,7 @@ qreal Calculator::EvalFormula(const QString &formula) QMap tokens = this->GetTokens(); // Remove "-" from tokens list if exist. If don't do that unary minus operation will broken. - RemoveAll(tokens, "-"); + RemoveAll(tokens, QStringLiteral("-")); if (tokens.isEmpty()) { @@ -132,6 +135,7 @@ void Calculator::InitVariables(const VContainer *data, const QMap vVarVal = new qreal[2]; } + SCASSERT(data != nullptr) const QHash > *vars = data->DataVariables(); QMap::const_iterator i = tokens.constBegin(); @@ -225,7 +229,7 @@ void Calculator::SetSepForTr(bool fromUser) { if (fromUser) { - bool osSeparatorValue = qApp->getSettings()->value("configuration/osSeparator", 1).toBool(); + const bool osSeparatorValue = qApp->getSettings()->GetOsSeparator(); if (osSeparatorValue) {