mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 20:42:40 +00:00
Fix crash when loading plugins from CLI and compilation when !ENABLE_UI
This commit is contained in:
parent
a7f3fc968a
commit
482fcd3b8c
@ -643,8 +643,10 @@ void Extension::exitScripts()
|
||||
ASSERT(cmd);
|
||||
|
||||
if (cmd) {
|
||||
#ifdef ENABLE_UI
|
||||
// TODO use a signal
|
||||
AppMenus::instance()->removeMenuItemWithCommand(cmd);
|
||||
#endif // ENABLE_UI
|
||||
|
||||
cmds->remove(cmd);
|
||||
|
||||
|
@ -128,14 +128,17 @@ int Plugin_newCommand(lua_State* L)
|
||||
Commands::instance()->add(cmd);
|
||||
plugin->ext->addCommand(id);
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
// Add a new menu option if the "group" is defined
|
||||
if (!group.empty()) {
|
||||
if (!group.empty() &&
|
||||
App::instance()->isGui()) { // On CLI menus do not make sense
|
||||
if (auto appMenus = AppMenus::instance()) {
|
||||
std::unique_ptr<MenuItem> menuItem(new AppMenuItem(title, cmd));
|
||||
appMenus->addMenuItemIntoGroup(
|
||||
group, title, std::move(menuItem));
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_UI
|
||||
}
|
||||
else {
|
||||
lua_pop(L, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user