From 8d09c1a3ade02211565a4c74ddaa72a15138f574 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 2 Aug 2007 16:21:49 +0000 Subject: [PATCH] Don't crash at getRandom(0) svn-id: r28411 --- engines/gob/util.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index ec8bb59f063..40acf21f9e0 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -49,6 +49,9 @@ uint32 Util::getTimeKey(void) { } int16 Util::getRandom(int16 max) { + if (max == 0) + return 0; + return _vm->_rnd.getRandomNumber(max - 1); }