diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 4201f8bce9..f0fdea1eff 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -605,13 +605,18 @@ int sceFontDoneLib(u32 fontLibHandle) { // Open internal font into a FontLib u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) { - INFO_LOG(HLE, "sceFontOpen(%x, %x, %x, %x)", libHandle, index, mode, errorCodePtr); if (!Memory::IsValidAddress(errorCodePtr)) { - Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr); + // Would crash on the PSP. + ERROR_LOG(HLE, "sceFontOpen(%x, %x, %x, %x): invalid pointer", libHandle, index, mode, errorCodePtr); return 0; } + INFO_LOG(HLE, "sceFontOpen(%x, %x, %x, %x)", libHandle, index, mode, errorCodePtr); FontLib *fontLib = GetFontLib(libHandle); + if (fontLib == NULL) { + Memory::Write_U32(ERROR_FONT_INVALID_LIBID, errorCodePtr); + return 0; + } if (index >= internalFonts.size()) { Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr); return 0;