Couple more ad-hoc fixes for crashes on startup

This commit is contained in:
Lukas Matena 2024-11-14 12:10:45 +01:00
parent d2bed746b0
commit 2be3c9f867
2 changed files with 6 additions and 1 deletions

View File

@ -184,7 +184,7 @@ std::string escape_path_by_element(const std::string& path_string)
bool add_authorization_header(Http& http)
{
if (wxApp::GetInstance() == nullptr)
if (wxApp::GetInstance() == nullptr || ! GUI::wxGetApp().plater())
return false;
const std::string access_token = GUI::wxGetApp().plater()->get_user_account()->get_access_token();
if (!access_token.empty()) {

View File

@ -1186,6 +1186,11 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver& old_slic3
}
}
if (!wxApp::GetInstance() || ! GUI::wxGetApp().plater()) {
// The main thread might have start killing the UI.
return R_NOOP;
}
// regular update
if (params == UpdateParams::SHOW_NOTIFICATION) {
p->set_waiting_updates(updates);