From 66864beb77b7f426c2c7741fe761c637a3972aa3 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 5 Feb 2020 12:18:12 -0300 Subject: [PATCH] lua: Fix crash calling app.refresh() from a script using -b -script from CLI --- src/app/script/app_object.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/script/app_object.cpp b/src/app/script/app_object.cpp index 89d24ebad..f44338727 100644 --- a/src/app/script/app_object.cpp +++ b/src/app/script/app_object.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2019 Igara Studio S.A. +// Copyright (C) 2018-2020 Igara Studio S.A. // Copyright (C) 2015-2018 David Capello // // This program is distributed under the terms of @@ -229,7 +229,9 @@ int App_alert(lua_State* L) int App_refresh(lua_State* L) { #ifdef ENABLE_UI - app_refresh_screen(); + app::Context* ctx = App::instance()->context(); + if (ctx && ctx->isUIAvailable()) + app_refresh_screen(); #endif return 0; }