mirror of https://github.com/AxioDL/metaforce.git
Prevent potential nullptr deeref
This commit is contained in:
parent
ff8c1b15a1
commit
b4c2cf2ea4
|
@ -347,6 +347,9 @@ void ImGuiConsole::ShowInspectWindow(bool* isOpen) {
|
||||||
bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) {
|
bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) {
|
||||||
bool open = true;
|
bool open = true;
|
||||||
ImGuiEntityEntry& entry = ImGuiConsole::entities[uid.Value()];
|
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());
|
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)) {
|
if (ImGui::Begin(name.c_str(), &open, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::PushID(uid.Value());
|
ImGui::PushID(uid.Value());
|
||||||
|
|
Loading…
Reference in New Issue