From 17fcccd31f7bdc18b3a86180e4c5a028ec7bd1dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 28 Oct 2016 13:52:50 +0200 Subject: [PATCH] [apps/calculation] Correct assignement operator Change-Id: I1ef13c064b9151b8d0b1b53fb6c40c6f2ba2304b --- apps/calculation/calculation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 9078ac7c8..412fa585c 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -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;