Corrected a potential invalid memory access
This commit is contained in:
parent
56693fab9b
commit
fb129fa7a1
1 changed files with 7 additions and 4 deletions
|
|
@ -675,10 +675,13 @@ bool amount_t::is_zero() const
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
stream_out_mpq(out, MP(quantity), commodity().precision());
|
stream_out_mpq(out, MP(quantity), commodity().precision());
|
||||||
|
|
||||||
for (const char * p = out.str().c_str(); *p; p++)
|
string output = out.str();
|
||||||
if (*p != '0' && *p != '.' && *p != '-')
|
if (! output.empty()) {
|
||||||
return false;
|
for (const char * p = output.c_str(); *p; p++)
|
||||||
|
if (*p != '0' && *p != '.' && *p != '-')
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue