diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2021-03-22 17:32:21 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-22 17:46:17 +0100 |
commit | ba2df70eabc12d140d29e45e00cd50dc3f72d722 (patch) | |
tree | 30d3ee69dc112f7794403848a0136111944db3ee /Userland/Applications/Spreadsheet/SpreadsheetWidget.h | |
parent | 534626f917f90402b5d86f9e6562fa961a2eb034 (diff) | |
download | serenity-ba2df70eabc12d140d29e45e00cd50dc3f72d722.zip |
Spreadsheet: Do not assume that a worksheet always exists
Fixes #5910.
Fixes #4822 (as far as I can tell).
Diffstat (limited to 'Userland/Applications/Spreadsheet/SpreadsheetWidget.h')
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetWidget.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h index b29fc557d6..e787f1af63 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h @@ -46,8 +46,7 @@ public: void add_sheet(NonnullRefPtr<Sheet>&&); const String& current_filename() const { return m_workbook->current_filename(); } - const Sheet& current_worksheet() const { return m_selected_view->sheet(); } - Sheet& current_worksheet() { return m_selected_view->sheet(); } + Sheet* current_worksheet_if_available() { return m_selected_view ? m_selected_view->sheet_if_available() : nullptr; } void set_filename(const String& filename); Workbook& workbook() { return *m_workbook; } |