aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2018-08-04 06:42:17 +0200
committerBastien Bouclet2018-08-04 06:42:17 +0200
commitad3feae490f8ed8ac74e8c6597963807bf9e278e (patch)
tree00ba0f102cc33e6b4355507d8fe3a3115bd3fc1a
parent7362060c47f5136ba8ea3cd617ef957057ac4296 (diff)
downloadscummvm-rg350-ad3feae490f8ed8ac74e8c6597963807bf9e278e.tar.gz
scummvm-rg350-ad3feae490f8ed8ac74e8c6597963807bf9e278e.tar.bz2
scummvm-rg350-ad3feae490f8ed8ac74e8c6597963807bf9e278e.zip
MOHAWK: RIVEN: Fix crash when clicking on a marble with the mouse moving
In some cases a mouse moved event could be handled between the moment the xtakeit script was queued and the moment it is executed (on the same frame), causing the mouse position no longer to be over a marble rectangle. Fixes #10647.
-rw-r--r--engines/mohawk/riven_stacks/tspit.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/mohawk/riven_stacks/tspit.cpp b/engines/mohawk/riven_stacks/tspit.cpp
index 9546d946ab..85e4b2f4ae 100644
--- a/engines/mohawk/riven_stacks/tspit.cpp
+++ b/engines/mohawk/riven_stacks/tspit.cpp
@@ -362,8 +362,12 @@ void TSpit::xtakeit(const ArgumentArray &args) {
}
}
- // xtakeit() shouldn't be called if we're not on a marble hotspot
- assert(marble != 0);
+ if (marble == 0) {
+ // xtakeit() shouldn't be called if we're not on a marble hotspot,
+ // but maybe another mouse moved event was received between the moment
+ // this script was queued and the moment it was executed.
+ return;
+ }
// Redraw the background
_vm->getCard()->drawPicture(1);