Prevent potential nullptr deeref

This commit is contained in:
Phillip Stephens 2021-05-31 13:11:01 -07:00
parent ff8c1b15a1
commit b4c2cf2ea4
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 3 additions and 0 deletions

View File

@ -347,6 +347,9 @@ void ImGuiConsole::ShowInspectWindow(bool* isOpen) {
bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) {
bool open = true;
ImGuiEntityEntry& entry = ImGuiConsole::entities[uid.Value()];
if (entry.ent == nullptr) {
return false;
}
auto name = fmt::format(FMT_STRING("{}##0x{:04X}"), !entry.name.empty() ? entry.name : entry.type, uid.Value());
if (ImGui::Begin(name.c_str(), &open, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::PushID(uid.Value());