From f91c85a90034ff588a8d5be36ae0ce27e826a744 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Fri, 10 Aug 2018 01:04:31 +0200 Subject: [PATCH] Crash fix --- AI/VCAI/VCAI.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 14716da56..9bf388287 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -1473,7 +1473,8 @@ void VCAI::wander(HeroPtr h) if(bestObjectGoal->goalType == Goals::GET_OBJ) { auto chosenObject = cb->getObjInstance(ObjectInstanceID(bestObjectGoal->objid)); - logAi->debug("Of all %d destinations, object %s at pos=%s seems nice", dests.size(), chosenObject->getObjectName(), chosenObject->pos.toString()); + if(chosenObject != nullptr) + logAi->debug("Of all %d destinations, object %s at pos=%s seems nice", dests.size(), chosenObject->getObjectName(), chosenObject->pos.toString()); } else logAi->debug("Trying to realize goal of type %d as part of wandering.", bestObjectGoal->goalType);