From 76c9e7a9eec793b81b4b82ca237fefb71731a0f0 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Sun, 9 May 2021 10:11:35 +0200 Subject: [PATCH] Fix game crash. WHen overlay is shown, you have at least 1 friend connected and you resize the game window smaller to the friend list position, it crashes because ImGui::ListBoxHeader returns false when its clipped and ImGui::ListBoxFooter shouldn't be called. --- overlay_experimental/steam_overlay.cpp | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/overlay_experimental/steam_overlay.cpp b/overlay_experimental/steam_overlay.cpp index 387962c..4002278 100644 --- a/overlay_experimental/steam_overlay.cpp +++ b/overlay_experimental/steam_overlay.cpp @@ -657,22 +657,24 @@ void Steam_Overlay::OverlayProc() std::lock_guard lock(overlay_mutex); if (!friends.empty()) { - ImGui::ListBoxHeader("##label", friends.size()); - std::for_each(friends.begin(), friends.end(), [this](std::pair &i) + if (ImGui::ListBoxHeader("##label", friends.size())) { - ImGui::PushID(i.second.id-base_friend_window_id+base_friend_item_id); - - ImGui::Selectable(i.second.window_title.c_str(), false, ImGuiSelectableFlags_AllowDoubleClick); - BuildContextMenu(i.first, i.second); - if (ImGui::IsItemClicked() && ImGui::IsMouseDoubleClicked(0)) + std::for_each(friends.begin(), friends.end(), [this](std::pair &i) { - i.second.window_state |= window_state_show; - } - ImGui::PopID(); + ImGui::PushID(i.second.id-base_friend_window_id+base_friend_item_id); - BuildFriendWindow(i.first, i.second); - }); - ImGui::ListBoxFooter(); + ImGui::Selectable(i.second.window_title.c_str(), false, ImGuiSelectableFlags_AllowDoubleClick); + BuildContextMenu(i.first, i.second); + if (ImGui::IsItemClicked() && ImGui::IsMouseDoubleClicked(0)) + { + i.second.window_state |= window_state_show; + } + ImGui::PopID(); + + BuildFriendWindow(i.first, i.second); + }); + ImGui::ListBoxFooter(); + } } } ImGui::End();