summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/amount.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/amount.cc b/src/amount.cc
index a6c1eb35..ded85e74 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -675,10 +675,13 @@ bool amount_t::is_zero() const
std::ostringstream out;
stream_out_mpq(out, MP(quantity), commodity().precision());
-
- for (const char * p = out.str().c_str(); *p; p++)
- if (*p != '0' && *p != '.' && *p != '-')
- return false;
+
+ string output = out.str();
+ if (! output.empty()) {
+ for (const char * p = output.c_str(); *p; p++)
+ if (*p != '0' && *p != '.' && *p != '-')
+ return false;
+ }
return true;
}
}