Skip to content

Commit e032eda

Browse files
committed
fix: fix newCommand
1 parent 3bbf2d5 commit e032eda

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/legacy/api/CommandAPI.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,15 @@ Local<Value> McClass::newCommand(const Arguments& args) {
232232

233233
try {
234234
auto name = args[0].asString().toString();
235-
auto instance = ll::service::getCommandRegistry()->findCommand(name);
236-
if (instance) {
237-
lse::getSelfPluginInstance().getLogger().info(
238-
"Runtime command {} already exists, changes will not beapplied except for setOverload!"_tr(name)
239-
);
240-
return CommandClass::newCommand(name);
235+
auto registry = ll::service::getCommandRegistry();
236+
if (registry) {
237+
auto instance = registry->findCommand(name);
238+
if (instance) {
239+
lse::getSelfPluginInstance().getLogger().info(
240+
"Runtime command {} already exists, changes will not beapplied except for setOverload!"_tr(name)
241+
);
242+
return CommandClass::newCommand(name);
243+
}
241244
}
242245

243246
auto desc = args[1].asString().toString();

0 commit comments

Comments
 (0)