summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 6f945002..e95f6350 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -1228,14 +1228,16 @@ void amount_t::read_xml(std::istream& in)
void amount_t::write_xml(std::ostream& out, const int depth) const
{
- xml_print(out, "<amount>\n", depth);
+ out << xml_str("<amount>\n", depth);
- commodity().write_xml(out, depth + 1);
+ if (has_commodity())
+ commodity().write_xml(out, depth + 1);
- xml_print(out, "<quantity>", depth + 1);
- out << quantity_string() << "</quantity>\n";
+ out << xml_str("<quantity>", depth + 1)
+ << quantity_string()
+ << "</quantity>\n";
- xml_print(out, "</amount>\n", depth);
+ out << xml_str("</amount>\n", depth);
}
bool amount_t::valid() const