mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
add size check to removal of trailing zeros in number formats
This commit is contained in:
parent
c99d14792f
commit
a1688c7e48
|
@ -1172,7 +1172,7 @@ std::string number_formatter::fill_placeholders(const format_placeholders &p, lo
|
|||
auto exponent = number != 0 ? static_cast<int>(std::log10(integer_part)) : 0;
|
||||
auto result = std::to_string(exponent);
|
||||
|
||||
while (result.back() == '0' || result.size() > (p.num_zeros + p.num_optionals))
|
||||
while (!result.empty() && (result.back() == '0' || result.size() > (p.num_zeros + p.num_optionals)))
|
||||
{
|
||||
result.pop_back();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user