summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Budde <mbudde@gmail.com>2019-02-23 14:36:43 +0100
committerMartin Michlmayr <tbm@cyrius.com>2019-03-30 19:47:47 +0700
commit13044f9c8d5757b6885d78cb5f7f37770e3750ab (patch)
treed9f6960a86f975ea49aceecd8ddbadb24d5e54a0
parent151b762e6a0e60015336b3a53e20358e058384d3 (diff)
downloadfork-ledger-13044f9c8d5757b6885d78cb5f7f37770e3750ab.tar.gz
fork-ledger-13044f9c8d5757b6885d78cb5f7f37770e3750ab.tar.bz2
fork-ledger-13044f9c8d5757b6885d78cb5f7f37770e3750ab.zip
Reject postings with comment after flag
Fixes #1753
-rw-r--r--doc/NEWS.md2
-rw-r--r--src/textual.cc2
-rw-r--r--test/regress/1753.test12
3 files changed, 15 insertions, 1 deletions
diff --git a/doc/NEWS.md b/doc/NEWS.md
index 8b3ec1fc..ce468b7f 100644
--- a/doc/NEWS.md
+++ b/doc/NEWS.md
@@ -2,6 +2,8 @@
## 3.1.3 (unreleased)
+- Properly reject postings with a comment right after the flag (bug #1753)
+
- Make sorting order of lot information deterministic (bug #1747)
- Remove the `org` command, which was always a hack to begin with (bug #1706)
diff --git a/src/textual.cc b/src/textual.cc
index 04e90e45..258e2560 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -1440,7 +1440,7 @@ post_t * instance_t::parse_post(char * line,
// Parse the account name
- if (! *p)
+ if (! *p || *p == ';')
throw parse_error(_("Posting has no account"));
char * next = next_element(p, true);
diff --git a/test/regress/1753.test b/test/regress/1753.test
new file mode 100644
index 00000000..4df9851b
--- /dev/null
+++ b/test/regress/1753.test
@@ -0,0 +1,12 @@
+2018-01-02 * Account name starting with semicolon
+ * ;A 10.00 EUR
+ B
+
+test reg -> 1
+__ERROR__
+While parsing file "$FILE", line 2:
+While parsing posting:
+ * ;A 10.00 EUR
+
+Error: Posting has no account
+end test