From 2b60cc8a0c9bd4e1e95b78c96aafe22e0d17bf3a Mon Sep 17 00:00:00 2001 From: RichieSams Date: Mon, 16 Sep 2013 00:12:45 -0500 Subject: ZVISION: Test for file.open() success before continuing with font loading --- engines/zvision/truetype_font.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/zvision') 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); -- cgit v1.2.3