summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-01-18 03:41:20 -0500
committerJohn Wiegley <johnw@newartisans.com>2010-01-18 03:41:20 -0500
commit67ce17e24959f55a4cd55857c7741d058397d758 (patch)
treec77cbf49617aea589cac7c4b0ca245f426793fd5 /src/item.cc
parentb3a3ecccf2e8ddaab79b58fb68b134a39d29c395 (diff)
downloadfork-ledger-67ce17e24959f55a4cd55857c7741d058397d758.tar.gz
fork-ledger-67ce17e24959f55a4cd55857c7741d058397d758.tar.bz2
fork-ledger-67ce17e24959f55a4cd55857c7741d058397d758.zip
Guard against using an uninitialized value
Fixes DDB54BB8-8C1C-4129-A137-07A38068F3BE
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/item.cc b/src/item.cc
index 99d1d835..f86b8ec8 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -437,9 +437,12 @@ void print_item(std::ostream& out, const item_t& item, const string& prefix)
string item_context(const item_t& item, const string& desc)
{
+ if (! item.pos)
+ return empty_string;
+
std::streamoff len = item.pos->end_pos - item.pos->beg_pos;
if (! len)
- return _("<no item context>");
+ return empty_string;
assert(len > 0);
assert(len < 2048);