mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 08:49:37 +08:00
fix: avoid width overflow
This commit is contained in:
@@ -406,8 +406,8 @@ struct serializer
|
||||
}
|
||||
|
||||
const auto key_and_sep = this->serialize_key(kv.first) + " = ";
|
||||
const auto residual_width = this->width_ - key_and_sep.size();
|
||||
|
||||
const auto residual_width = (this->width_ > key_and_sep.size()) ?
|
||||
this->width_ - key_and_sep.size() : 0;
|
||||
token += key_and_sep;
|
||||
token += visit(serializer(residual_width, this->float_prec_, true),
|
||||
kv.second);
|
||||
|
Reference in New Issue
Block a user