summaryrefslogtreecommitdiff
path: root/src/csv.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-10-15 09:45:23 -0700
committerJohn Wiegley <johnw@newartisans.com>2012-10-15 09:45:23 -0700
commit385cbd25b9905b16a4c7723bb4e5a5813e84aab0 (patch)
tree3ffa12d9ae72f422281dcab6f9b26f60c80747ea /src/csv.cc
parentc2cc47bc986fbceedf79af55eb87b46fa99fe497 (diff)
parent937c9c7bd1a96ca24ecae71695f12bd25641c14c (diff)
downloadfork-ledger-385cbd25b9905b16a4c7723bb4e5a5813e84aab0.tar.gz
fork-ledger-385cbd25b9905b16a4c7723bb4e5a5813e84aab0.tar.bz2
fork-ledger-385cbd25b9905b16a4c7723bb4e5a5813e84aab0.zip
Merge pull request #89 from kljohann/bugs.convert
fix several ledger convert bugs
Diffstat (limited to 'src/csv.cc')
-rw-r--r--src/csv.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/csv.cc b/src/csv.cc
index 71b6516a..4992372a 100644
--- a/src/csv.cc
+++ b/src/csv.cc
@@ -166,7 +166,7 @@ xact_t * csv_reader::read_xact(bool rich_data)
string total;
string field;
- while (instr.good() && ! instr.eof()) {
+ while (instr.good() && ! instr.eof() && n < index.size()) {
field = read_field(instr);
switch (index[n]) {
@@ -175,7 +175,8 @@ xact_t * csv_reader::read_xact(bool rich_data)
break;
case FIELD_DATE_AUX:
- xact->_date_aux = parse_date(field);
+ if (! field.empty())
+ xact->_date_aux = parse_date(field);
break;
case FIELD_CODE:
@@ -224,7 +225,8 @@ xact_t * csv_reader::read_xact(bool rich_data)
break;
case FIELD_NOTE:
- xact->note = field;
+ if (! field.empty())
+ xact->note = field;
break;
case FIELD_UNKNOWN: