mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ZVISION: Test for file.open() success before continuing with font loading
This commit is contained in:
@@ -53,11 +53,17 @@ TruetypeFont::~TruetypeFont(void) {
|
||||
bool TruetypeFont::loadFile(const Common::String &filename) {
|
||||
Common::File file;
|
||||
|
||||
bool fileOpened = false;
|
||||
if (!Common::File::exists(filename)) {
|
||||
debug("TTF font file %s was not found. Reverting to arial.ttf", filename.c_str());
|
||||
file.open("arial.ttf");
|
||||
fileOpened = file.open("arial.ttf");
|
||||
} else {
|
||||
file.open(filename);
|
||||
fileOpened = file.open(filename);
|
||||
}
|
||||
|
||||
if (!fileOpened) {
|
||||
debug("TTF file could not be opened");
|
||||
return false;
|
||||
}
|
||||
|
||||
_font = Graphics::loadTTFFont(file, _fontHeight);
|
||||
|
||||
Reference in New Issue
Block a user