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:
javabird25 2022-03-07 14:02:50 +05:00 committed by Ali Mohammad Pur
parent ce9f355b12
commit 67d10a50ee

View file

@ -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;
});