summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-07-15 00:55:45 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:16 -0400
commitc29eed174de09e1477ee31c87cf3e2f2dd445b9e (patch)
treeaed4231f2d90e948db1d224e940033f1a76c801b
parentf8610dbfd7155d188daa999ac712bfedfed309bc (diff)
downloadfork-ledger-c29eed174de09e1477ee31c87cf3e2f2dd445b9e.tar.gz
fork-ledger-c29eed174de09e1477ee31c87cf3e2f2dd445b9e.tar.bz2
fork-ledger-c29eed174de09e1477ee31c87cf3e2f2dd445b9e.zip
(process_options): Test the "i" and "arg" variables thoroughly before
making use of either one of them.
-rw-r--r--config.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/config.cc b/config.cc
index 885c37db..099162e8 100644
--- a/config.cc
+++ b/config.cc
@@ -182,10 +182,11 @@ void config_t::process_options(const std::string& command,
if (*i == "--")
break;
- regexps_to_predicate(*this, command, arg, i++, true,
- (command == "b" && ! show_subtotal &&
- display_predicate.empty()));
- if (i != args_end)
+ if (i != arg)
+ regexps_to_predicate(*this, command, arg, i, true,
+ (command == "b" && ! show_subtotal &&
+ display_predicate.empty()));
+ if (i != args_end && ++i != args_end)
regexps_to_predicate(*this, command, i, args_end);
}