aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-10-06 11:00:24 -0700
committerPaul Gilbert2019-10-06 11:00:24 -0700
commitd831218b985c1ab66bc4e52f6b79142eb0fa79b9 (patch)
tree2a99ca7a12d5df5d7935532e78b6b997c31d95eb /engines/glk
parente06ec24807e88d688c67539d20efe41d165aa608 (diff)
downloadscummvm-rg350-d831218b985c1ab66bc4e52f6b79142eb0fa79b9.tar.gz
scummvm-rg350-d831218b985c1ab66bc4e52f6b79142eb0fa79b9.tar.bz2
scummvm-rg350-d831218b985c1ab66bc4e52f6b79142eb0fa79b9.zip
GLK: Fix reading beyond the end of a file
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/streams.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp
index 37cac4437a..d6d62ddbec 100644
--- a/engines/glk/streams.cpp
+++ b/engines/glk/streams.cpp
@@ -989,7 +989,7 @@ int IOStream::getChar() {
ensureOp(filemode_Read);
int res;
if (!_unicode) {
- res = _inStream->readByte();
+ res = (_inStream->pos() >= _inStream->size()) ? -1 : _inStream->readByte();
} else if (_textFile) {
res = getCharUtf8();
} else {