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.
merge-requests/39/head
Nemirtingas 2021-05-09 10:11:35 +02:00
parent ff6c3e994b
commit 76c9e7a9ee
1 changed files with 15 additions and 13 deletions

View File

@ -657,22 +657,24 @@ void Steam_Overlay::OverlayProc()
std::lock_guard<std::recursive_mutex> lock(overlay_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
if (!friends.empty()) if (!friends.empty())
{ {
ImGui::ListBoxHeader("##label", friends.size()); if (ImGui::ListBoxHeader("##label", friends.size()))
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
{ {
ImGui::PushID(i.second.id-base_friend_window_id+base_friend_item_id); std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
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::PushID(i.second.id-base_friend_window_id+base_friend_item_id);
}
ImGui::PopID();
BuildFriendWindow(i.first, i.second); ImGui::Selectable(i.second.window_title.c_str(), false, ImGuiSelectableFlags_AllowDoubleClick);
}); BuildContextMenu(i.first, i.second);
ImGui::ListBoxFooter(); if (ImGui::IsItemClicked() && ImGui::IsMouseDoubleClicked(0))
{
i.second.window_state |= window_state_show;
}
ImGui::PopID();
BuildFriendWindow(i.first, i.second);
});
ImGui::ListBoxFooter();
}
} }
} }
ImGui::End(); ImGui::End();