aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-05-15 16:33:58 -1000
committerPaul Gilbert2019-05-15 16:33:58 -1000
commit68ef5ebfd6f842b152a8bb03ade5be0b6b526fd8 (patch)
tree18ba01dd50cca099baba65a2375216fe978e2fcd /engines
parent84bd8c6b46b405c3c14e8be6868d3a1534879d52 (diff)
downloadscummvm-rg350-68ef5ebfd6f842b152a8bb03ade5be0b6b526fd8.tar.gz
scummvm-rg350-68ef5ebfd6f842b152a8bb03ade5be0b6b526fd8.tar.bz2
scummvm-rg350-68ef5ebfd6f842b152a8bb03ade5be0b6b526fd8.zip
GLK: HUGO: Fix reading savegame serial
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/hugo/hugo.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h
index 2be3bfd680..882917c38a 100644
--- a/engines/glk/hugo/hugo.h
+++ b/engines/glk/hugo/hugo.h
@@ -1040,9 +1040,9 @@ private:
char *hugo_fgets(char *buf, int max, Common::SeekableReadStream *s) {
char *ptr = buf;
char c;
- while (s->pos() < s->size()) {
+ while (s->pos() < s->size() && --max > 0) {
c = hugo_fgetc(s);
- if (c == '\n' || c == '\0' || (max-- == 0))
+ if (c == '\n' || c == '\0')
break;
*ptr++ = c;
}