From 945fb65759345552b103bf764d6e7b7981f95963 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 4 Apr 2026 09:07:36 +0200 Subject: [PATCH] Error when using CommandOverrideAdd() before MOD_LOAD, since in MOD_INIT the command may not have been added yet thus then you get silly module-load-order issues, such as in previous commit 281d0cce9b8b44105447b2eefa65b88323c61041 --- src/modules.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules.c b/src/modules.c index f4af81dc7..02e0374e5 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1148,7 +1148,17 @@ CommandOverride *CommandOverrideAdd(Module *module, const char *name, int priori { RealCommand *p; CommandOverride *ovr; - + + if (module && (loop.config_status <= CONFIG_STATUS_INIT)) + { + unreal_log(ULOG_ERROR, "module", "BUG_COMMANDOVERRIDEADD_NOT_MOD_LOAD", NULL, + "[BUG] CommandOverrideAdd() called by module '$module_name' before MOD_LOAD(). " + "This must be in MOD_LOAD(), otherwise the command to be overridden may not exist yet.", + log_data_string("module_name", module->header->name)); + module->errorcode = MODERR_INVALID; + return NULL; + } + if (!(p = find_command_simple(name))) { if (module)