From c31cc8c060358f51c4ec60bc128142b01b6a9f41 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Oct 2020 18:52:54 +0200 Subject: [PATCH] FileManager: Ignore model updates during widget construction We can't use current_view() before we've actually constructed the subviews, so just ignore statusbar update requests before they get a chance to call current_view(). This is not the most beautiful thing, and maybe we can think of a nicer approach. --- Applications/FileManager/DirectoryView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp index 1beac3bbb45..0089be9c0df 100644 --- a/Applications/FileManager/DirectoryView.cpp +++ b/Applications/FileManager/DirectoryView.cpp @@ -388,6 +388,10 @@ void DirectoryView::open_next_directory() void DirectoryView::update_statusbar() { + // If we're triggered during widget construction, just ignore it. + if (m_view_mode == ViewMode::Invalid) + return; + size_t total_size = model().node({}).total_size; if (current_view().selection().is_empty()) { set_status_message(String::formatted("{} item(s) ({})",