gsdx osd: set m_face to null in case of error

This commit is contained in:
Gregory Hainaut 2017-01-22 16:42:01 +01:00
parent 9120c3bfb1
commit 9183d1d2c6
1 changed files with 7 additions and 5 deletions

View File

@ -27,11 +27,12 @@ void GSOsdManager::LoadFont() {
FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face); FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face);
if (error) { if (error) {
m_face = NULL; m_face = NULL;
fprintf(stderr, "Failed to init the freetype face\n"); fprintf(stderr, "Failed to init the freetype face\n");
if(error == FT_Err_Unknown_File_Format) if(error == FT_Err_Unknown_File_Format)
fprintf(stderr, "\tFreetype unknown file format\n"); fprintf(stderr, "\tFreetype unknown file format\n");
return; return;
} }
LoadSize(); LoadSize();
} }
@ -39,7 +40,6 @@ void GSOsdManager::LoadFont() {
void GSOsdManager::LoadSize() { void GSOsdManager::LoadSize() {
if (!m_face) return; if (!m_face) return;
m_size = theApp.GetConfigI("osd_fontsize");
FT_Error error = FT_Set_Pixel_Sizes(m_face, 0, m_size);; FT_Error error = FT_Set_Pixel_Sizes(m_face, 0, m_size);;
if (error) { if (error) {
fprintf(stderr, "Failed to init the face size\n"); fprintf(stderr, "Failed to init the face size\n");
@ -64,8 +64,10 @@ GSOsdManager::GSOsdManager() : m_atlas_h(0)
m_indicator_enabled = theApp.GetConfigB("osd_indicator_enabled"); m_indicator_enabled = theApp.GetConfigB("osd_indicator_enabled");
m_osd_transparency = std::max(0, std::min(theApp.GetConfigI("osd_transparency"), 100)); m_osd_transparency = std::max(0, std::min(theApp.GetConfigI("osd_transparency"), 100));
m_max_onscreen_messages = theApp.GetConfigI("osd_max_log_messages"); m_max_onscreen_messages = theApp.GetConfigI("osd_max_log_messages");
m_size = theApp.GetConfigI("osd_fontsize");
if (FT_Init_FreeType(&m_library)) { if (FT_Init_FreeType(&m_library)) {
m_face = NULL;
fprintf(stderr, "Failed to init the freetype library\n"); fprintf(stderr, "Failed to init the freetype library\n");
return; return;
} }