aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-21 07:37:26 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-21 07:37:26 +0100
commit2e3465d3bdf0fa1e7df779cbd19fc90187574ae8 (patch)
tree2c32aba49d0483c48d8cadef54bfdeee2c8ac9d5
parentade32bea240fa74f01d4dd4792b1069cca619bba (diff)
Remove abort if font is not available
m---------depends/mglpp0
-rw-r--r--src/ResourceLoader.cpp6
-rw-r--r--src/Text.cpp3
3 files changed, 7 insertions, 2 deletions
diff --git a/depends/mglpp b/depends/mglpp
-Subproject c56af6cf176671182e42afc27ac4392fb13b2c4
+Subproject 3a924a2c5487b8d1785633ddba4f320a82a04cc
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);