From c3fb9babbb48b0fc1395651e1fc9edd5e9ca6c9a Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Fri, 6 Dec 2024 01:29:51 +0000 Subject: [PATCH] imgui_snapshot: check if game is loaded before accessing XDBF --- UnleashedRecomp/gpu/imgui_snapshot.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/UnleashedRecomp/gpu/imgui_snapshot.cpp b/UnleashedRecomp/gpu/imgui_snapshot.cpp index e6107f7b..0b375a22 100644 --- a/UnleashedRecomp/gpu/imgui_snapshot.cpp +++ b/UnleashedRecomp/gpu/imgui_snapshot.cpp @@ -5,6 +5,7 @@ #include #include #include +#include void ImDrawDataSnapshot::Clear() { @@ -221,14 +222,17 @@ void ImFontAtlasSnapshot::GenerateGlyphRanges() } } - for (size_t i = XDBF_LANGUAGE_ENGLISH; i <= XDBF_LANGUAGE_ITALIAN; i++) + if (g_isGameLoaded) { - auto achievements = g_xdbfWrapper.GetAchievements(static_cast(i)); - for (auto& achievement : achievements) + for (size_t i = XDBF_LANGUAGE_ENGLISH; i <= XDBF_LANGUAGE_ITALIAN; i++) { - GetGlyphs(glyphs, achievement.Name); - GetGlyphs(glyphs, achievement.UnlockedDesc); - GetGlyphs(glyphs, achievement.LockedDesc); + auto achievements = g_xdbfWrapper.GetAchievements(static_cast(i)); + for (auto& achievement : achievements) + { + GetGlyphs(glyphs, achievement.Name); + GetGlyphs(glyphs, achievement.UnlockedDesc); + GetGlyphs(glyphs, achievement.LockedDesc); + } } }