[apps/calculation] Correct assignement operator

Change-Id: I1ef13c064b9151b8d0b1b53fb6c40c6f2ba2304b
This commit is contained in:
Émilie Feral
2016-10-28 13:52:50 +02:00
parent dba85cc56a
commit 17fcccd31f

View File

@@ -15,11 +15,15 @@ Calculation & Calculation::operator= (const Calculation & other) {
if (m_expression != nullptr) {
delete m_expression;
}
m_expression = Expression::parse(m_text);
m_expression = nullptr;
if (other.m_expression) {
m_expression = Expression::parse(m_text);
}
if (m_layout != nullptr) {
delete m_layout;
}
if (m_expression) {
m_layout = nullptr;
if (m_expression && other.m_layout) {
m_layout = m_expression->createLayout();
}
m_evaluation = other.m_evaluation;