aboutsummaryrefslogtreecommitdiff
path: root/engines/m4
diff options
context:
space:
mode:
authorJohannes Schickel2010-03-24 21:39:26 +0000
committerJohannes Schickel2010-03-24 21:39:26 +0000
commit86c779bed8eb6e023cc7c281016580474304dc8b (patch)
treeda48b732dabac579f6d2cfd94912ba17ee8cdf93 /engines/m4
parent5315993ffcee93693bb0fed2c27afe0399163557 (diff)
downloadscummvm-rg350-86c779bed8eb6e023cc7c281016580474304dc8b.tar.gz
scummvm-rg350-86c779bed8eb6e023cc7c281016580474304dc8b.tar.bz2
scummvm-rg350-86c779bed8eb6e023cc7c281016580474304dc8b.zip
Prevent inifinite loop caused by a check of an unsigned integer against >= 0.
svn-id: r48397
Diffstat (limited to 'engines/m4')
-rw-r--r--engines/m4/mads_views.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index 8b17a935f2..32328f8a13 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -132,9 +132,12 @@ int ScreenObjects::scan(int xp, int yp, int layer) {
}
int ScreenObjects::scanBackwards(int xp, int yp, int layer) {
- for (uint i = _entries.size() - 1; i >= 0; --i) {
+ for (uint i = _entries.size() - 1; ; --i) {
if (_entries[i].active && _entries[i].bounds.contains(xp, yp) && (_entries[i].layer == layer))
return i + 1;
+
+ if (i == 0)
+ break;
}
// Entry not found