diff options
| author | 2019-10-07 21:11:30 +0200 | |
|---|---|---|
| committer | 2019-10-07 21:14:33 +0200 | |
| commit | 9538cf4d4c99e0b63e641b281970bb169166d42f (patch) | |
| tree | c001c781db3623f829c68f4252ecdb993ff9d33a /diceparser.cpp | |
| parent | 5e28288120abb5a4c0ee3f303dd1b98515807df9 (diff) | |
| download | OneRoll-9538cf4d4c99e0b63e641b281970bb169166d42f.tar.gz OneRoll-9538cf4d4c99e0b63e641b281970bb169166d42f.zip | |
Protect all dynamic casts.
Diffstat (limited to 'diceparser.cpp')
| -rw-r--r-- | diceparser.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/diceparser.cpp b/diceparser.cpp index 3f346e9..ad8400d 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -518,18 +518,21 @@ void DiceParser::getDiceResultFromAllInstruction(QList<ExportedDiceResult>& resu if(result->hasResultOfType(Dice::RESULT_TYPE::DICE_LIST)) { DiceResult* diceResult= dynamic_cast<DiceResult*>(result); - QList<HighLightDice> list; - quint64 faces= 0; - - for(auto& die : diceResult->getResultList()) + if(diceResult) { - faces= die->getFaces(); - // qDebug() << "face" << faces; - HighLightDice hlDice(die->getListValue(), die->isHighlighted(), die->getColor(), - die->hasBeenDisplayed(), die->getFaces()); - list.append(hlDice); + QList<HighLightDice> list; + quint64 faces= 0; + + for(auto& die : diceResult->getResultList()) + { + faces= die->getFaces(); + // qDebug() << "face" << faces; + HighLightDice hlDice(die->getListValue(), die->isHighlighted(), die->getColor(), + die->hasBeenDisplayed(), die->getFaces()); + list.append(hlDice); + } + nodeResult.insert(faces, list); } - nodeResult.insert(faces, list); } result= result->getPrevious(); } |