From 821b47e5b13167bc89841762311296e1ed0bedba Mon Sep 17 00:00:00 2001 From: Renaud Guezennec Date: Tue, 26 Jan 2016 14:51:26 +0100 Subject: -Fix issue #2 --- node/jumpbackwardnode.cpp | 50 ++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'node/jumpbackwardnode.cpp') diff --git a/node/jumpbackwardnode.cpp b/node/jumpbackwardnode.cpp index b0a5c8e..25056b1 100644 --- a/node/jumpbackwardnode.cpp +++ b/node/jumpbackwardnode.cpp @@ -70,31 +70,41 @@ void JumpBackwardNode::run(ExecutionNode* previous) } } - DiceResult* diceResult = dynamic_cast(result); - foreach(Die* die,diceResult->getResultList()) + if(NULL==result) { - Die* tmpdie = new Die(); - *tmpdie=*die; - m_diceResult->insertResult(tmpdie); - die->displayed(); + m_errors.insert(DIE_RESULT_EXPECTED,QObject::tr(" The @ operator expects dice result. Please check the documentation to fix your command.")); } + else + { + DiceResult* diceResult = dynamic_cast(result); + if(NULL!=diceResult) + { + foreach(Die* die,diceResult->getResultList()) + { + Die* tmpdie = new Die(); + *tmpdie=*die; + m_diceResult->insertResult(tmpdie); + die->displayed(); + } + } + m_result->setPrevious(parent->getResult()); - m_result->setPrevious(parent->getResult()); - - - - if(NULL!=m_nextNode) - { - m_nextNode->run(this); - } - for(int i =0;igetResultList().size();++i) - { - Die* tmp =diceResult->getResultList().at(i); - Die* tmp2 =m_diceResult->getResultList().at(i); - if(tmp->isHighlighted()) + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } + if(NULL!=diceResult) { - tmp2->setHighlighted(true); + for(int i =0;igetResultList().size();++i) + { + Die* tmp =diceResult->getResultList().at(i); + Die* tmp2 =m_diceResult->getResultList().at(i); + if(tmp->isHighlighted()) + { + tmp2->setHighlighted(true); + } + } } } -- cgit v1.2.3-70-g09d2