Catch exceptions loading bitmap fonts

As now loadBitmapFont() throws exception in case of error, we have to
catch the problem to avoid a crash/uncaught exception.
This commit is contained in:
David Capello 2015-03-26 09:31:32 -03:00
parent 995e09bb60
commit e4a2b4a1ba

View File

@ -2166,13 +2166,15 @@ she::Font* SkinTheme::loadFont(const char* userFont, const std::string& path)
// Try to load the font
while (rf.next()) {
she::Font* f = she::instance()->loadBitmapFont(rf.filename().c_str(), guiscale());
if (f) {
try {
she::Font* f = she::instance()->loadBitmapFont(rf.filename().c_str(), guiscale());
if (f->isScalable())
f->setSize(8);
return f;
}
catch (const std::exception& ex) {
// Do nothing
}
}
return nullptr;