diff options
Diffstat (limited to 'engines/zvision/scr_file_handling.cpp')
-rw-r--r-- | engines/zvision/scr_file_handling.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 5b8af48047..9c99ce184d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -76,7 +76,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("criteria {", true)) { Puzzle::Criteria criteria; if (parseCriteria(&criteria, stream)) { @@ -103,7 +103,7 @@ bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableRe return false; } - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { // Split the string into tokens using ' ' as a delimiter Common::StringTokenizer tokenizer(line); Common::String token; @@ -147,7 +147,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis trimCommentsAndWhiteSpace(&line); // TODO: Re-order the if-then statements in order of highest occurrence - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.empty()) { line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -284,7 +284,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("ONCE_PER_INST", true)) { flags |= Puzzle::ONCE_PER_INST; } else if (line.matchString("DO_ME_NOW", true)) { |