check if steam not found

Which also fixes the crash if steam was on login window
This commit is contained in:
Skull 2022-08-04 10:36:43 +03:00
parent 7853119110
commit 3e1708bebf

View File

@ -35,6 +35,11 @@ namespace steam_proxy
{ {
return; return;
} }
if (!FindWindowA(0, "Steam"))
{
return;
}
this->load_client(); this->load_client();
this->clean_up_on_error(); this->clean_up_on_error();
@ -152,29 +157,29 @@ namespace steam_proxy
void clean_up_on_error() void clean_up_on_error()
{ {
scheduler::schedule([this]() scheduler::schedule([this]()
{
if (this->steam_client_module_
&& this->steam_pipe_
&& this->global_user_
&& this->steam_client_module_.invoke<bool>("Steam_BConnected", this->global_user_,
this->steam_pipe_)
&& this->steam_client_module_.invoke<bool>("Steam_BLoggedOn", this->global_user_, this->steam_pipe_)
)
{ {
if (this->steam_client_module_ return scheduler::cond_continue;
&& this->steam_pipe_ }
&& this->global_user_
&& this->steam_client_module_.invoke<bool>("Steam_BConnected", this->global_user_,
this->steam_pipe_)
&& this->steam_client_module_.invoke<bool>("Steam_BLoggedOn", this->global_user_, this->steam_pipe_)
)
{
return scheduler::cond_continue;
}
this->client_engine_ = nullptr; this->client_engine_ = nullptr;
this->client_user_ = nullptr; this->client_user_ = nullptr;
this->client_utils_ = nullptr; this->client_utils_ = nullptr;
this->steam_pipe_ = nullptr; this->steam_pipe_ = nullptr;
this->global_user_ = nullptr; this->global_user_ = nullptr;
this->steam_client_module_ = utils::nt::library{nullptr}; this->steam_client_module_ = utils::nt::library{nullptr};
return scheduler::cond_end; return scheduler::cond_end;
}); });
} }
}; };