diff options
author | RichieSams | 2013-09-16 00:12:45 -0500 |
---|---|---|
committer | RichieSams | 2013-09-16 00:17:24 -0500 |
commit | 2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a (patch) | |
tree | 8324625a85b345a08e84f4379072d80c18a500c5 /engines | |
parent | c7e2bdd2b2730225d1d76b22c71e7733ed61f23c (diff) | |
download | scummvm-rg350-2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a.tar.gz scummvm-rg350-2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a.tar.bz2 scummvm-rg350-2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a.zip |
ZVISION: Test for file.open() success before continuing with font loading
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/truetype_font.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index d88f22a727..8c5c279e78 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -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); |