Spreadsheet: Fix overridden max length related crash
NumericCell::display() attempted to take a substring of cell contents according to the "Override max length" parameter, but it did not account for the actual string length.
This commit is contained in:
parent
ce9f355b12
commit
67d10a50ee
Notes:
sideshowbarker
2024-07-17 17:46:03 +09:00
Author: https://github.com/utkinn Commit: https://github.com/SerenityOS/serenity/commit/67d10a50ee Pull-request: https://github.com/SerenityOS/serenity/pull/12924 Issue: https://github.com/SerenityOS/serenity/issues/12901
1 changed files with 1 additions and 1 deletions
|
@ -28,7 +28,7 @@ JS::ThrowCompletionOr<String> NumericCell::display(Cell& cell, const CellTypeMet
|
|||
string = format_double(metadata.format.characters(), TRY(value.to_double(cell.sheet().global_object())));
|
||||
|
||||
if (metadata.length >= 0)
|
||||
return string.substring(0, metadata.length);
|
||||
return string.substring(0, min(string.length(), metadata.length));
|
||||
|
||||
return string;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue