Guard against using an uninitialized value

Fixes DDB54BB8-8C1C-4129-A137-07A38068F3BE
This commit is contained in:
John Wiegley 2010-01-18 03:41:20 -05:00
parent b3a3ecccf2
commit 67ce17e249

View file

@ -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);