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

Spreadsheet: Ensure that cell exists on drop event for text data

Fixes crash where we tried to get a cell to set text from the drop
event. We now create the cell if it does not already exists.

Fixes issue #5923
This commit is contained in:
David Isaksson 2021-03-23 22:08:16 +01:00 committed by Andreas Kling
parent 6179c9ad25
commit 391d1ddfd8

View file

@ -297,10 +297,8 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
}
if (event.mime_data().has_text()) {
auto* target_cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() });
VERIFY(target_cell);
target_cell->set_data(event.text());
auto& target_cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
target_cell.set_data(event.text());
return;
}
};