[Scummvm-git-logs] scummvm master -> 307cd0db4a75b57a0fc61f8af25ae175c5255181

dreammaster dreammaster at scummvm.org
Thu Sep 8 04:35:18 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
307cd0db4a SHERLOCK: RT: Fix crash using invalid number keys in conversations


Commit: 307cd0db4a75b57a0fc61f8af25ae175c5255181
    https://github.com/scummvm/scummvm/commit/307cd0db4a75b57a0fc61f8af25ae175c5255181
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-07T22:35:10-04:00

Commit Message:
SHERLOCK: RT: Fix crash using invalid number keys in conversations

Changed paths:
    engines/sherlock/tattoo/widget_talk.cpp



diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index b673f32..aec6645 100644
--- a/engines/sherlock/tattoo/widget_talk.cpp
+++ b/engines/sherlock/tattoo/widget_talk.cpp
@@ -196,22 +196,21 @@ void WidgetTalk::handleEvents() {
 
 	// Handle selecting a talk entry if a numeric key has been pressed
 	if (keycode >= Common::KEYCODE_1 && keycode <= Common::KEYCODE_9) {
-		int x = 0, t = 0, y = 0;
+		int x = 0, y = 0, t;
+
+		for (t = 0; t < (int)_statementLines.size(); ++t) {
+			if (t > 0 && _statementLines[x]._num != _statementLines[t]._num) {
+				x = t;
+				++y;
+			}
 
-		do {
 			if (y == (keycode - Common::KEYCODE_1)) {
 				_selector = _statementLines[t]._num;
 				_outsideMenu = false;
 				hotkey = true;
 				break;
 			}
-
-			++t;
-			if (_statementLines[x]._num != _statementLines[t]._num) {
-				x = t;
-				++y;
-			}
-		} while (t < (int)_statementLines.size());
+		}
 	}
 
 	// Display the selected statement highlighted and reset the last statement.





More information about the Scummvm-git-logs mailing list