diff options
| author | 2018-04-09 10:24:20 +0200 | |
|---|---|---|
| committer | 2018-04-09 10:26:21 +0200 | |
| commit | 510b8da8874bdafa0bd72efbd9d0521ccc4d964d (patch) | |
| tree | e6b4383a262796e8b67b8992ec21d15cf7a29acb /node/rerolldicenode.cpp | |
| parent | 5037bbc102fec39fbdef810427c31cb0a1722709 (diff) | |
| download | OneRoll-510b8da8874bdafa0bd72efbd9d0521ccc4d964d.tar.gz OneRoll-510b8da8874bdafa0bd72efbd9d0521ccc4d964d.zip | |
-Fix #4 crash with mishaped command.
And prevent this error to happen with other nodes.
Diffstat (limited to 'node/rerolldicenode.cpp')
| -rw-r--r-- | node/rerolldicenode.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp index c156dac..2ead761 100644 --- a/node/rerolldicenode.cpp +++ b/node/rerolldicenode.cpp @@ -19,7 +19,7 @@ void RerollDiceNode::run(ExecutionNode* previous) m_previousNode = previous; if((nullptr!=previous)&&(nullptr!=previous->getResult())) { - DiceResult* previous_result = static_cast<DiceResult*>(previous->getResult()); + DiceResult* previous_result = dynamic_cast<DiceResult*>(previous->getResult()); m_result->setPrevious(previous_result); if(nullptr!=previous_result) { @@ -47,6 +47,11 @@ void RerollDiceNode::run(ExecutionNode* previous) m_nextNode->run(this); } } + else + { + m_errors.insert(ExecutionNode::DIE_RESULT_EXPECTED, + QObject::tr(" The a operator expects dice result. Please check the documentation and fix your command.")); + } } } void RerollDiceNode::setValidator(Validator* val) |