From 588f316fd670a2d7000e66a29bf9e8dbbc5fdf96 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 21 Oct 2021 16:37:40 +0100 Subject: [PATCH] Do not crash if default font cant be loaded Signed-off-by: falkTX --- src/Window.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 8745845..86d0a9e 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -112,7 +112,8 @@ void WindowInit(Window* const window, DISTRHO_NAMESPACE::UI* const ui) // Load default Blendish font window->uiFont = window->loadFont(asset::system("res/fonts/DejaVuSans.ttf")); - bndSetFont(window->uiFont->handle); + if (window->uiFont != nullptr) + bndSetFont(window->uiFont->handle); // Init settings WindowParametersRestore(window); @@ -167,7 +168,8 @@ void Window::step() { // Make event handlers and step() have a clean NanoVG context // nvgReset(vg); - bndSetFont(uiFont->handle); + if (uiFont != nullptr) + bndSetFont(uiFont->handle); // Set window title std::string windowTitle = APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION;