Merge pull request #819 from unknownbrackets/fonts

Font crash fixes
This commit is contained in:
Henrik Rydgård committed 2013-02-28 12:01:52 -08:00
commit 314c28516b
1 file changed
+12 -4
+12 -4
View File
@@ -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;
}