forked from mia/Aegisub
Skip invalid commands when constructing the toolbar and menu rather than exploding
Originally committed to SVN as r5478.
This commit is contained in:
parent
c32e372dd4
commit
3d22da9fbc
|
@ -100,7 +100,14 @@ wxMenu* Menu::BuildMenu(std::string name, const json::Array& array, int submenu)
|
||||||
|
|
||||||
|
|
||||||
std::string cmd_name = type == Menu::Submenu ? name_submenu : command.Value();
|
std::string cmd_name = type == Menu::Submenu ? name_submenu : command.Value();
|
||||||
cmd::Command *cmd = cmd::get(cmd_name);
|
cmd::Command *cmd;
|
||||||
|
try {
|
||||||
|
cmd = cmd::get(cmd_name);
|
||||||
|
}
|
||||||
|
catch (CommandNotFound const&) {
|
||||||
|
LOG_W("menu/command/not_found") << "Command '" << cmd_name << "' not found; skipping";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
wxString display = cmd->StrMenu() + "\t" + hotkey::get_hotkey_str_first("Default", cmd_name);
|
wxString display = cmd->StrMenu() + "\t" + hotkey::get_hotkey_str_first("Default", cmd_name);
|
||||||
wxString descr = cmd->StrHelp();
|
wxString descr = cmd->StrHelp();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libaegisub/json.h>
|
#include <libaegisub/json.h>
|
||||||
|
#include <libaegisub/log.h>
|
||||||
#include <libaegisub/signal.h>
|
#include <libaegisub/signal.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -105,7 +106,14 @@ namespace {
|
||||||
AddSeparator();
|
AddSeparator();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd::Command *command = cmd::get(command_name.Value());
|
cmd::Command *command;
|
||||||
|
try {
|
||||||
|
command = cmd::get(command_name.Value());
|
||||||
|
}
|
||||||
|
catch (CommandNotFound const&) {
|
||||||
|
LOG_W("toolbar/command/not_found") << "Command '" << command_name.Value() << "' not found; skipping";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
wxBitmap const& bitmap = command->Icon(icon_size);
|
wxBitmap const& bitmap = command->Icon(icon_size);
|
||||||
// this hack is needed because ???
|
// this hack is needed because ???
|
||||||
|
|
Loading…
Reference in a new issue