diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ResourceLoader.cpp | 6 | ||||
-rw-r--r-- | src/Text.cpp | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ResourceLoader.cpp b/src/ResourceLoader.cpp index 89ae510..9e8a884 100644 --- a/src/ResourceLoader.cpp +++ b/src/ResourceLoader.cpp @@ -111,19 +111,21 @@ namespace QuickMedia::FontLoader { if(!successfully_loaded_file) { fprintf(stderr, "Warning: Failed to load font file: %s\n", font_file_name.c_str()); - abort(); } mapped_file = new_memory_mapped_file.get(); font_file_cache[(unsigned int)font_type] = std::move(new_memory_mapped_file); } + if(!mapped_file->data()) { + return nullptr; + } + mgl::Font *font = font_cache[(unsigned int)font_type][character_size].get(); if(!font) { auto new_font = std::make_unique<mgl::Font>(); if(!new_font->load_from_file(*mapped_file, character_size)) { fprintf(stderr, "Warning: Failed to load font at character size %u\n", character_size); - abort(); } font = new_font.get(); diff --git a/src/Text.cpp b/src/Text.cpp index 39e5bc4..53118b8 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1115,6 +1115,9 @@ namespace QuickMedia continue; mgl::Font *font = FontLoader::get_font(font_types[i], characterSize); + if(!font) + continue; + mgl::Texture font_texture = font->get_texture(); vertex_buffers[i].set_texture(&font_texture); vertex_buffers[i].set_position(pos); |