diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2014-05-14 17:52:05 -0400 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2014-05-14 17:53:43 -0400 |
commit | 86fd99c9d0d8ed46f3eb89a7bf0d17eadef574e8 (patch) | |
tree | b0dde2595a19991eca7d6c813311ad30a1a6fd57 /src/textual.cc | |
parent | 60d9c2bc1d8095f06c13fbf1bcce2d5c587a3a64 (diff) | |
download | fork-ledger-86fd99c9d0d8ed46f3eb89a7bf0d17eadef574e8.tar.gz fork-ledger-86fd99c9d0d8ed46f3eb89a7bf0d17eadef574e8.tar.bz2 fork-ledger-86fd99c9d0d8ed46f3eb89a7bf0d17eadef574e8.zip |
Ensure that directives have arguments if they need one
Ensure that account, commodity and payee directives have arguments
if they need one. Bug fix for #785
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/textual.cc b/src/textual.cc index 60250007..a1b17c14 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -918,6 +918,10 @@ void instance_t::account_directive(char * line) char * b = next_element(q); string keyword(q); + // Ensure there's an argument for the directives that need one. + if (! b && keyword != "default") + throw_(parse_error, _f("Account directive '%1%' requires an argument") % keyword); + if (keyword == "alias") { account_alias_directive(account, b); } @@ -1034,6 +1038,9 @@ void instance_t::payee_directive(char * line) char * b = next_element(p); string keyword(p); + if (! b) + throw_(parse_error, _f("Payee directive '%1%' requires an argument") % keyword); + if (keyword == "alias") payee_alias_directive(payee, b); if (keyword == "uuid") @@ -1073,6 +1080,10 @@ void instance_t::commodity_directive(char * line) char * b = next_element(q); string keyword(q); + // Ensure there's an argument for the directives that need one. + if (! b && keyword != "nomarket" && keyword != "default") + throw_(parse_error, _f("Commodity directive '%1%' requires an argument") % keyword); + if (keyword == "alias") commodity_alias_directive(*commodity, b); else if (keyword == "value") |