summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actorsprite.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 92894b04..a7821699 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -115,7 +115,8 @@ void ActorSprite::actorLogic()
{
for (int type = TCT_NORMAL; type < NUM_TCT; type++)
{
- targetCursor[type][size]->update(tick_time * MILLISECONDS_IN_A_TICK);
+ if (targetCursor[type][size])
+ targetCursor[type][size]->update(tick_time * MILLISECONDS_IN_A_TICK);
}
}
}
@@ -405,7 +406,8 @@ void ActorSprite::cleanupTargetCursors()
for (int type = TCT_NORMAL; type < NUM_TCT; type++)
{
delete targetCursor[type][size];
- targetCursorImages[type][size]->decRef();
+ if (targetCursorImages[type][size])
+ targetCursorImages[type][size]->decRef();
}
}
}
@@ -419,6 +421,12 @@ void ActorSprite::loadTargetCursor(const std::string &filename,
ResourceManager *resman = ResourceManager::getInstance();
ImageSet *currentImageSet = resman->getImageSet(filename, width, height);
+ if (!currentImageSet)
+ {
+ logger->log("Error loading target cursor: %s", filename.c_str());
+ return;
+ }
+
Animation *anim = new Animation;
for (unsigned int i = 0; i < currentImageSet->size(); ++i)