Skip to content
Extraits de code Groupes Projets
Valider 3d22da9f rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Skip invalid commands when constructing the toolbar and menu rather than exploding

Originally committed to SVN as r5478.
parent c32e372d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -100,7 +100,14 @@ wxMenu* Menu::BuildMenu(std::string name, const json::Array& array, int submenu) ...@@ -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 @@ ...@@ -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 { ...@@ -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 ???
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter