From 1bcbca899d8e8df18b40247729fbcb044f2e12a4 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 30 Jan 2021 20:21:42 +0100 Subject: [PATCH] Add checks to font loading --- inferno/src/inferno/render/font.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inferno/src/inferno/render/font.cpp b/inferno/src/inferno/render/font.cpp index a693c86..f9b530a 100644 --- a/inferno/src/inferno/render/font.cpp +++ b/inferno/src/inferno/render/font.cpp @@ -69,6 +69,7 @@ namespace Inferno { } } + ASSERT(elements.empty(), "Font file did not find any columns"); return elements; } @@ -76,13 +77,14 @@ namespace Inferno { { size_t find = 0; // Loop over columns - for (auto it = columns.begin(); it != columns.end(); it++) { - find = it->find(key + "="); + for (auto& column : columns) { + find = column.find(key + "="); if (find != std::string::npos) { - return it->substr(key.length() + 1); + return column.substr(key.length() + 1); } } + ASSERT(false, "Font file did not contain key '{}'", key); return ""; }