aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2018-08-09 19:34:40 +0100
committerD G Turner2018-08-09 19:35:14 +0100
commit8c4b448d31ca10d7cb46a238fe9882c0531f01e0 (patch)
tree2e3d956ad7da5bc0ca129de3d0e1e13d8b57413b
parent86c6e3f4604c0932ed450f0c349383bc2f375dea (diff)
downloadscummvm-rg350-8c4b448d31ca10d7cb46a238fe9882c0531f01e0.tar.gz
scummvm-rg350-8c4b448d31ca10d7cb46a238fe9882c0531f01e0.tar.bz2
scummvm-rg350-8c4b448d31ca10d7cb46a238fe9882c0531f01e0.zip
STARTREK: Fix Accesses to Uninitialized Variable.
-rw-r--r--engines/startrek/actors.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/engines/startrek/actors.cpp b/engines/startrek/actors.cpp
index 9f16f0f8ec..aef7a7baff 100644
--- a/engines/startrek/actors.cpp
+++ b/engines/startrek/actors.cpp
@@ -41,23 +41,24 @@ void StarTrekEngine::initActors() {
int StarTrekEngine::loadActorAnim(int actorIndex, const Common::String &animName, int16 x, int16 y, Fixed8 scale) {
debugC(6, kDebugGraphics, "Load animation '%s' on actor %d", animName.c_str(), actorIndex);
- Actor *actor;
+ Actor *actor = nullptr;
if (actorIndex == -1) {
// TODO
warning("loadActorAnim: actor == -1");
- } else
+ } else {
actor = &_actorList[actorIndex];
- if (actor->spriteDrawn) {
- releaseAnim(actor);
- drawActorToScreen(actor, animName, x, y, scale, false);
- } else {
- drawActorToScreen(actor, animName, x, y, scale, true);
- }
+ if (actor->spriteDrawn) {
+ releaseAnim(actor);
+ drawActorToScreen(actor, animName, x, y, scale, false);
+ } else {
+ drawActorToScreen(actor, animName, x, y, scale, true);
+ }
- actor->triggerActionWhenAnimFinished = false;
- actor->finishedAnimActionParam = 0;
+ actor->triggerActionWhenAnimFinished = false;
+ actor->finishedAnimActionParam = 0;
+ }
return actorIndex;
}