diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index a3ff7af981..7125478ba8 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -443,7 +443,9 @@ void __FontInit() { void __FontShutdown() { for (auto iter = fontMap.begin(); iter != fontMap.end(); iter++) { - iter->second->GetFontLib()->CloseFont(iter->second); + FontLib *fontLib = iter->second->GetFontLib(); + if (fontLib) + fontLib->CloseFont(iter->second); } fontMap.clear(); for (auto iter = fontLibMap.begin(); iter != fontLibMap.end(); iter++) { @@ -577,10 +579,16 @@ u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u32 error } int sceFontClose(u32 fontHandle) { - INFO_LOG(HLE, "sceFontClose(%x)", fontHandle); LoadedFont *font = GetLoadedFont(fontHandle, false); - FontLib *fontLib = font->GetFontLib(); - fontLib->CloseFont(font); + if (font) + { + INFO_LOG(HLE, "sceFontClose(%x)", fontHandle); + FontLib *fontLib = font->GetFontLib(); + if (fontLib) + fontLib->CloseFont(font); + } + else + ERROR_LOG(HLE, "sceFontClose(%x) - font not open?", fontHandle); return 0; }