From bcdf245a9b805ec919320b7163501b0a41c88fa2 Mon Sep 17 00:00:00 2001 From: Chris Shoemaker Date: Sun, 12 Feb 2006 20:31:11 +0000 Subject: [PATCH] Don't continue to parse the expression if we've already reached the end. Fixes http://bugzilla.gnome.org/show_bug.cgi?id=166840. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13243 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/calculation/expression_parser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calculation/expression_parser.c b/src/calculation/expression_parser.c index 98de093e9d..eff4d365d4 100644 --- a/src/calculation/expression_parser.c +++ b/src/calculation/expression_parser.c @@ -363,7 +363,7 @@ * Note: The parser/evaluator uses a simple recursive descent * parser. I decided on this type for the simple reason that for a * simple four function calculator a recursive descent parser is, in - * my opnion, the easiest to construct. I also think that recursive + * my opinion, the easiest to construct. I also think that recursive * descent parsers are easier for the human to understand and thus * maintain. * @@ -751,8 +751,11 @@ free_var (var_store_ptr value, parser_env_ptr pe) static void add_token (parser_env_ptr pe, char token) { - *pe->token_tail = pe->Token = token; - pe->token_tail++; + pe->Token = token; + if ((token != EOS) || (*pe->token_tail != EOS)) { + *pe->token_tail = token; + pe->token_tail++; + } } /* parse next token from string */