From 839cb16ce3fa0eb26cb9a30df7afe72f2f073a0f Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 19 Oct 2018 15:18:29 +0100 Subject: [PATCH] Fix FileParser::getNextArg() to read in line if required. --- src/base/fileparser.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/base/fileparser.h b/src/base/fileparser.h index e9b06cbb6..3b79ba49d 100644 --- a/src/base/fileparser.h +++ b/src/base/fileparser.h @@ -92,9 +92,21 @@ class FileParser return (result == 0); } // Read next delimited argument from file - bool readArg(QString& variable) + bool readNextArg(QString& variable) { + // If we are at the end of the current line, read in the next... + if (parser_.atEndOfLine()) + { + if (parser_.readNextLine(Parser::Defaults) != 0) + { + variable.clear(); + return false; + } + } + + // Get next argument from current line if (!parser_.getNextArg(Parser::Defaults, variable)) return false; + return true; } // Read next line from file into the variable supplied, and parse it as well