mirror of
https://github.com/hyprwm/hyprutils.git
synced 2025-12-30 14:20:12 +01:00
mat3x3: check for finite in toString
if values are NaN or inf it will crash std::format, safeguard it.
This commit is contained in:
parent
bcabcbada9
commit
60306ca059
1 changed files with 5 additions and 0 deletions
|
|
@ -143,6 +143,11 @@ Mat3x3 Mat3x3::copy() const {
|
|||
}
|
||||
|
||||
std::string Mat3x3::toString() const {
|
||||
for (const auto& m : matrix) {
|
||||
if (!std::isfinite(m))
|
||||
return "[mat3x3: invalid values]";
|
||||
}
|
||||
|
||||
return std::format("[mat3x3: {}, {}, {}, {}, {}, {}, {}, {}, {}]", matrix.at(0), matrix.at(1), matrix.at(2), matrix.at(3), matrix.at(4), matrix.at(5), matrix.at(6),
|
||||
matrix.at(7), matrix.at(8));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue