From 0745e3684d676a751ed85edbf7a8bca2773c7727 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Mon, 6 Feb 2023 00:26:54 +0100 Subject: [PATCH] AppLauncher: Fix potential crash --- GlosSITarget/AppLauncher.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GlosSITarget/AppLauncher.cpp b/GlosSITarget/AppLauncher.cpp index b270a69..fa9137a 100644 --- a/GlosSITarget/AppLauncher.cpp +++ b/GlosSITarget/AppLauncher.cpp @@ -251,9 +251,11 @@ void AppLauncher::getProcessHwnds() IPropertyStore* propStore; SHGetPropertyStoreForWindow(curr_wnd, IID_IPropertyStore, reinterpret_cast(&propStore)); PROPVARIANT prop; - propStore->GetValue(PKEY_AppUserModel_ID, &prop); - if (prop.bstrVal != nullptr && std::wstring(prop.bstrVal) == launched_uwp_path_) { - process_hwnds_.push_back(curr_wnd); + if (propStore != nullptr) { + propStore->GetValue(PKEY_AppUserModel_ID, &prop); + if (prop.bstrVal != nullptr && std::wstring(prop.bstrVal) == launched_uwp_path_) { + process_hwnds_.push_back(curr_wnd); + } } } while (curr_wnd != nullptr); }