summaryrefslogtreecommitdiff
path: root/src/koopatlas/pathmanager.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-27 15:35:54 +0200
committerTreeki <treeki@gmail.com>2012-09-27 15:35:54 +0200
commitcd2ceff21f680a7d33b43a6926b4e556e81d625b (patch)
tree25ac0285c6cf813224c7534edcb802251e3149f2 /src/koopatlas/pathmanager.cpp
parent261cd42b5eaad3add529a7464410fcb256fefeab (diff)
downloadkamek-cd2ceff21f680a7d33b43a6926b4e556e81d625b.tar.gz
kamek-cd2ceff21f680a7d33b43a6926b4e556e81d625b.zip
fixed a possible crash bug where the HUD was accessed before it was created
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 97d9265..6134dc6 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -368,7 +368,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("moving to path %p [%d,%d to %d,%d]\n", path, path->start->x, path->start->y, path->end->x, path->end->y);
if (!path->isAvailable) { return; }
- if (currentNode)
+ if (currentNode && dWMHud_c::instance)
dWMHud_c::instance->leftNode();
calledEnteredNode = false;
@@ -545,7 +545,7 @@ void dWMPathManager_c::moveThroughPath() {
float distToEnd = VECMag(&toEndVec);
//OSReport("Distance: %f; To:%d,%d; Player:%f,%f; Diff:%f,%f\n", distToEnd, to->x, to->y, player->pos.x, player->pos.y, toEndVec.x, toEndVec.y);
- if (distToEnd < 64.0f) {
+ if (distToEnd < 64.0f && dWMHud_c::instance) {
calledEnteredNode = true;
dWMHud_c::instance->enteredNode(to);
}
@@ -615,7 +615,8 @@ void dWMPathManager_c::moveThroughPath() {
save->hudHintS = world->hudHintS;
save->hudHintL = world->hudHintL;
- dWMHud_c::instance->hideAndShowFooter();
+ if (dWMHud_c::instance)
+ dWMHud_c::instance->hideAndShowFooter();
}
} else {
OSReport("Not found!\n");
@@ -655,7 +656,7 @@ void dWMPathManager_c::moveThroughPath() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
save->current_path_node = pathLayer->findNodeID(to);
- if (!calledEnteredNode)
+ if (!calledEnteredNode && dWMHud_c::instance)
dWMHud_c::instance->enteredNode();
} else {
startMovementTo(to->getOppositeAvailableExitTo(currentPath));