mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +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:
parent
6179c9ad25
commit
391d1ddfd8
Notes:
sideshowbarker
2024-07-18 21:06:47 +09:00
Author: https://github.com/Granddave 🔰
Commit: 391d1ddfd8
Pull-request: https://github.com/SerenityOS/serenity/pull/5928
Issue: https://github.com/SerenityOS/serenity/issues/5923
Reviewed-by: https://github.com/alimpfard ✅
1 changed files with 2 additions and 4 deletions
|
@ -297,10 +297,8 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.mime_data().has_text()) {
|
if (event.mime_data().has_text()) {
|
||||||
auto* target_cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() });
|
auto& target_cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
|
||||||
VERIFY(target_cell);
|
target_cell.set_data(event.text());
|
||||||
|
|
||||||
target_cell->set_data(event.text());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue