From 8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 30 Jan 2018 10:42:08 -0600 Subject: PARALLACTION: Fix invalid array access at dialogue selection Also removes an unnecessary second condition check for oldAnswer by moving that closer to its point of use. --- engines/parallaction/dialogue.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 4dbedc8dbe..ee92eee439 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -253,15 +253,14 @@ int16 DialogueManager::selectAnswerN() { _selection = _balloonMan->hitTestDialogueBalloon(_mousePos.x, _mousePos.y); - VisibleAnswer *oldAnswer = (_oldSelection == NO_ANSWER_SELECTED) ? NULL : &_visAnswers[_oldSelection]; - VisibleAnswer *answer = &_visAnswers[_selection]; - if (_selection != _oldSelection) { if (_oldSelection != NO_ANSWER_SELECTED) { + VisibleAnswer *oldAnswer = &_visAnswers[_oldSelection]; _balloonMan->setBalloonText(oldAnswer->_balloon, oldAnswer->_a->_text, BalloonManager::kUnselectedColor); } if (_selection != NO_ANSWER_SELECTED) { + VisibleAnswer *answer = &_visAnswers[_selection]; _balloonMan->setBalloonText(answer->_balloon, answer->_a->_text, BalloonManager::kSelectedColor); _gfx->setItemFrame(_faceId, answer->_a->speakerMood()); } -- cgit v1.2.3