diff --git a/src/app/commands/cmd_run_script.cpp b/src/app/commands/cmd_run_script.cpp index 3409ff230..b04dc48f7 100644 --- a/src/app/commands/cmd_run_script.cpp +++ b/src/app/commands/cmd_run_script.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018 Igara Studio S.A. +// Copyright (C) 2018-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -80,7 +80,10 @@ void RunScriptCommand::onExecute(Context* context) ->scriptEngine() ->evalFile(m_filename, m_params); - ui::Manager::getDefault()->invalidate(); +#if ENABLE_UI + if (context->isUIAvailable()) + ui::Manager::getDefault()->invalidate(); +#endif } std::string RunScriptCommand::onGetFriendlyName() const diff --git a/src/app/script/api_version.h b/src/app/script/api_version.h index a1759b2cd..4f66ee469 100644 --- a/src/app/script/api_version.h +++ b/src/app/script/api_version.h @@ -10,6 +10,6 @@ // Increment this value if the scripting API is modified between two // released Aseprite versions. -#define API_VERSION 17 +#define API_VERSION 18 #endif diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index 07712039c..8c01b7fde 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2022 Igara Studio S.A. // Copyright (C) 2018 David Capello // // This program is distributed under the terms of @@ -201,6 +201,10 @@ void Dialog_connect_signal(lua_State* L, int Dialog_new(lua_State* L) { + // If we don't have UI, just return nil + if (!App::instance()->isGui()) + return 0; + auto dlg = push_new(L); // The uservalue of the dialog userdata will contain a table that