From 6f73a4db0c27e4e25dacc519a9a1d7c10e370900 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 18 Jun 2010 07:27:18 -0400 Subject: Made "convert" command insensitive to null amounts --- src/convert.cc | 26 ++++++++++++++------------ 1 file 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_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_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; + } } } } -- cgit v1.2.3