lua: Fix crash calling app.refresh() from a script using -b -script from CLI

This commit is contained in:
David Capello 2020-02-05 12:18:12 -03:00
parent 7507c2e4eb
commit 66864beb77

View File

@ -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;
}