aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-10-07 21:11:30 +0200
committerRenaud G <renaud@rolisteam.org>2019-10-07 21:14:33 +0200
commit9538cf4d4c99e0b63e641b281970bb169166d42f (patch)
treec001c781db3623f829c68f4252ecdb993ff9d33a
parent5e28288120abb5a4c0ee3f303dd1b98515807df9 (diff)
downloadOneRoll-9538cf4d4c99e0b63e641b281970bb169166d42f.tar.gz
OneRoll-9538cf4d4c99e0b63e641b281970bb169166d42f.zip
Protect all dynamic casts.
-rw-r--r--diceparser.cpp23
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();
}