summaryrefslogtreecommitdiff
path: root/src/format.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-25 05:39:47 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-25 05:39:47 -0400
commitca1560d53d2dc6a0a78ba607296b22b5ebb0feb8 (patch)
tree78ac168fcacdbcf1d12fff31306a2c9ce7ae3d78 /src/format.cc
parent2899e3f852cdf1b2df2ad645f40e04df5511ec3b (diff)
downloadfork-ledger-ca1560d53d2dc6a0a78ba607296b22b5ebb0feb8.tar.gz
fork-ledger-ca1560d53d2dc6a0a78ba607296b22b5ebb0feb8.tar.bz2
fork-ledger-ca1560d53d2dc6a0a78ba607296b22b5ebb0feb8.zip
Fixed overflow bug introduced by the warning fixes
Diffstat (limited to 'src/format.cc')
-rw-r--r--src/format.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/format.cc b/src/format.cc
index 35f3d80f..ea38c861 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -368,8 +368,9 @@ void format_t::format(std::ostream& out_str, scope_t& scope)
result = truncate(temp, elem->max_width);
} else {
result = temp.extract();
- for (std::size_t i = 0; i < elem->min_width - temp.length(); i++)
- result += " ";
+ if (elem->min_width > temp.length())
+ for (std::size_t i = 0; i < elem->min_width - temp.length(); i++)
+ result += " ";
}
out_str << result;
} else {