1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

Spreadsheet: Prevent OOB access to text editor buffer

For some reason LibGUI sends two events for each edit, and one of them
contains an OOB cursor if a character was deleted.
This works around that for now.
This commit is contained in:
Ali Mohammad Pur 2022-06-25 19:06:59 +04:30 committed by Linus Groh
parent b691269912
commit 0e2f4c50d3

View file

@ -383,6 +383,7 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source,
m_inline_documentation_window->hide();
return;
}
cursor_offset = min(cursor_offset, source.length());
auto maybe_function_and_argument = get_function_and_argument_index(source.substring_view(0, cursor_offset));
if (!maybe_function_and_argument.has_value()) {
m_inline_documentation_window->hide();