summaryrefslogtreecommitdiff
path: root/src/convert.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-18 07:27:18 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-18 07:27:18 -0400
commit6f73a4db0c27e4e25dacc519a9a1d7c10e370900 (patch)
treeeb4188b029379bf42e75bbd16fdd8d8b6366bf2b /src/convert.cc
parent5da1e7756d2a4eb04753b8a97bc00063b4d3f687 (diff)
downloadfork-ledger-6f73a4db0c27e4e25dacc519a9a1d7c10e370900.tar.gz
fork-ledger-6f73a4db0c27e4e25dacc519a9a1d7c10e370900.tar.bz2
fork-ledger-6f73a4db0c27e4e25dacc519a9a1d7c10e370900.zip
Made "convert" command insensitive to null amounts
Diffstat (limited to 'src/convert.cc')
-rw-r--r--src/convert.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/convert.cc b/src/convert.cc
index d7ee52b7..5d3f23fa 100644
--- a/src/convert.cc
+++ b/src/convert.cc
@@ -97,18 +97,20 @@ value_t convert_command(call_scope_t& args)
}
bool matched = false;
- post_map_t::iterator i = post_map.find(- xact->posts.front()->amount);
- if (i != post_map.end()) {
- std::list<post_t *>& post_list((*i).second);
- foreach (post_t * post, post_list) {
- if (xact->code && post->xact->code &&
- *xact->code == *post->xact->code) {
- matched = true;
- break;
- }
- else if (xact->actual_date() == post->actual_date()) {
- matched = true;
- break;
+ if (! xact->posts.front()->amount.is_null()) {
+ post_map_t::iterator i = post_map.find(- xact->posts.front()->amount);
+ if (i != post_map.end()) {
+ std::list<post_t *>& post_list((*i).second);
+ foreach (post_t * post, post_list) {
+ if (xact->code && post->xact->code &&
+ *xact->code == *post->xact->code) {
+ matched = true;
+ break;
+ }
+ else if (xact->actual_date() == post->actual_date()) {
+ matched = true;
+ break;
+ }
}
}
}