summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
diff options
context:
space:
mode:
authorDavid Isaksson <davidisaksson93@gmail.com>2021-03-23 22:08:16 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-24 20:36:41 +0100
commit391d1ddfd87dc3cd77783e62299fb1df956ad3ce (patch)
tree2b652e8e4da9ab98ad1be0062c928e1101789d4c /Userland/Applications/Spreadsheet/SpreadsheetView.cpp
parent6179c9ad25c306079ea4b0718f333ff87b236773 (diff)
downloadserenity-391d1ddfd87dc3cd77783e62299fb1df956ad3ce.zip
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
Diffstat (limited to 'Userland/Applications/Spreadsheet/SpreadsheetView.cpp')
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index 8e49a2b162..1f3bf0ae9a 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -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;
}
};