Guard against using an uninitialized value
Fixes DDB54BB8-8C1C-4129-A137-07A38068F3BE
This commit is contained in:
parent
b3a3ecccf2
commit
67ce17e249
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
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;
|
std::streamoff len = item.pos->end_pos - item.pos->beg_pos;
|
||||||
if (! len)
|
if (! len)
|
||||||
return _("<no item context>");
|
return empty_string;
|
||||||
|
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
assert(len < 2048);
|
assert(len < 2048);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue