From 2792793bf35df4c17571085d436827d26e143e64 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Fri, 16 Aug 2019 10:37:45 +0200 Subject: [PATCH] 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. --- overlay_experimental/steam_overlay.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/overlay_experimental/steam_overlay.cpp b/overlay_experimental/steam_overlay.cpp index efd7cf9f..ecdcce87 100644 --- a/overlay_experimental/steam_overlay.cpp +++ b/overlay_experimental/steam_overlay.cpp @@ -172,7 +172,7 @@ void Steam_Overlay::ShowOverlay(bool state) { static RECT old_clip; - if (show_overlay == state) + if (!Ready() || show_overlay == state) return; show_overlay = state; @@ -215,6 +215,9 @@ void Steam_Overlay::ShowOverlay(bool state) void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId) { + if (!Ready()) + return; + std::lock_guard lock(global_mutex); auto i = friends.find(friendId); 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) { + if (!Ready()) + return; + std::lock_guard lock(global_mutex); auto i = friends.find(friendId); if (i != friends.end()) @@ -399,6 +405,9 @@ void Steam_Overlay::OverlayProc( int width, int height ) { std::lock_guard lock(global_mutex); + if (!Ready()) + return; + if (show_overlay) { int friend_size = friends.size();