From 87059f8ca3a6fa10a651c4432eb22e42eba90598 Mon Sep 17 00:00:00 2001 From: Yannis <52321382+yannis300307@users.noreply.github.com> Date: Wed, 4 Feb 2026 01:02:22 +0100 Subject: [PATCH] Check if font file exists --- runtime/Sources/Core/Bridge.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runtime/Sources/Core/Bridge.cpp b/runtime/Sources/Core/Bridge.cpp index 4dfed77..b2e7560 100644 --- a/runtime/Sources/Core/Bridge.cpp +++ b/runtime/Sources/Core/Bridge.cpp @@ -304,6 +304,11 @@ extern "C" mlx::Error("Font loader: filepath is NULL"); return; } + if (!std::filesystem::exists(filepath)) + { + mlx::Error("TTF loader: unable to find file '%'", filepath); + return; + } std::filesystem::path file(filepath); if(std::strcmp(filepath, "default") != 0 && file.extension() != ".ttf" && file.extension() != ".tte") { @@ -324,6 +329,11 @@ extern "C" mlx::Error("Font loader: filepath is NULL"); return; } + if (!std::filesystem::exists(filepath)) + { + mlx::Error("TTF loader: unable to find file '%'", filepath); + return; + } std::filesystem::path file(filepath); if(std::strcmp(filepath, "default") != 0 && file.extension() != ".ttf" && file.extension() != ".tte") {