Only call overlay related functions if it is ready

Continue to receive friends notifications, so if the overlay becomes ready we already have the list of friends.
This commit is contained in:
Nemirtingas 2019-08-16 10:37:45 +02:00
parent 40615d07a7
commit 2792793bf3

View File

@ -172,7 +172,7 @@ void Steam_Overlay::ShowOverlay(bool state)
{ {
static RECT old_clip; static RECT old_clip;
if (show_overlay == state) if (!Ready() || show_overlay == state)
return; return;
show_overlay = state; show_overlay = state;
@ -215,6 +215,9 @@ void Steam_Overlay::ShowOverlay(bool state)
void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId) void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
{ {
if (!Ready())
return;
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto i = friends.find(friendId); auto i = friends.find(friendId);
if (i != friends.end()) if (i != friends.end())
@ -229,6 +232,9 @@ void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str) void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
{ {
if (!Ready())
return;
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto i = friends.find(friendId); auto i = friends.find(friendId);
if (i != friends.end()) if (i != friends.end())
@ -399,6 +405,9 @@ void Steam_Overlay::OverlayProc( int width, int height )
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!Ready())
return;
if (show_overlay) if (show_overlay)
{ {
int friend_size = friends.size(); int friend_size = friends.size();