From 0b2f25a6e3fda014b0f5a4282283fb90b0958d42 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 6 Aug 2014 12:27:17 +0200 Subject: Restored -datadir and -langdir arguments, added -savedir Also, fixed some crashes when unable to open file --- src/graphics/engine/text.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/graphics/engine') diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 78cf7b8..6df8894 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -867,7 +867,13 @@ CachedFont* CText::GetOrOpenFont(FontType font, float size) } m_lastCachedFont = new CachedFont(); - m_lastCachedFont->font = TTF_OpenFontRW(CResourceManager::GetSDLFileHandler(mf->fileName), 1, pointSize); + SDL_RWops* file = CResourceManager::GetSDLFileHandler(mf->fileName); + if(file == nullptr) + { + m_error = std::string("Unable to open file"); + return nullptr; + } + m_lastCachedFont->font = TTF_OpenFontRW(file, 1, pointSize); if (m_lastCachedFont->font == nullptr) m_error = std::string("TTF_OpenFont error ") + std::string(TTF_GetError()); -- cgit v1.2.3-1-g7c22