]> git.lyx.org Git - features.git/commitdiff
Fix bug #8089: Handle spaces at the end of the stream
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 2 May 2012 11:41:09 +0000 (13:41 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 2 May 2012 12:41:08 +0000 (14:41 +0200)
If the stream is good (i.e. there are still tokens) and we expect an
argument, we call getArg(). However, if there are only spaces, the stream
suddenly isn't good anymore after 'skipSpaces' and we would get an error
when calling 'getChar'. Therefore we have to check whether the stream is
still good.

src/mathed/MathParser.cpp

index ad804e1f84bb3f9af1ec17337ac90b60a67f01be..df7169432048ca6252524d09f0f084f8ffcb59bf 100644 (file)
@@ -544,9 +544,12 @@ char_type Parser::getChar()
 
 docstring Parser::getArg(char_type left, char_type right)
 {
+       docstring result;
        skipSpaces();
 
-       docstring result;
+       if (!good())
+               return result;
+
        char_type c = getChar();
 
        if (c != left)