From a6ccc45d5bdef7345389dd96358883f123b9e5fc Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 15 May 2023 17:31:46 -0300 Subject: [PATCH] Fix crash calling app.command.LoadPalette() when the UI is not available (fix #3847) E.g. aseprite -b -script load.lua When load.lua is: app.command.LoadPalette() Was crashing the program. --- src/app/commands/cmd_load_palette.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_load_palette.cpp b/src/app/commands/cmd_load_palette.cpp index fb46d1a15..cb6136e08 100644 --- a/src/app/commands/cmd_load_palette.cpp +++ b/src/app/commands/cmd_load_palette.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2023 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -62,7 +63,7 @@ void LoadPaletteCommand::onExecute(Context* context) filename = m_filename; } #ifdef ENABLE_UI - else { + else if (context->isUIAvailable()) { base::paths exts = get_readable_palette_extensions(); base::paths filenames; if (app::show_file_selector(