Prechádzať zdrojové kódy

LibGUI: Don't update the recent files if we haven't created them yet

We previously assumed that `set_most_recently_open_file()` would only be
called after `Menu::add_recent_files_list()` had been called, and would
crash if we hadn't called it yet. This stops the crash. We're fine to
do this, because we always call `update_recent_file_actions()` in
`register_recent_file_actions()` so it's guaranteed to be up to date
when we do need it.
Sam Atkins 1 rok pred
rodič
commit
343de324db
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      Userland/Libraries/LibGUI/Application.cpp

+ 2 - 1
Userland/Libraries/LibGUI/Application.cpp

@@ -399,7 +399,8 @@ void Application::set_most_recently_open_file(ByteString new_path)
             path);
     }
 
-    update_recent_file_actions();
+    if (!m_recent_file_actions.is_empty())
+        update_recent_file_actions();
 }
 
 }