diff options
Diffstat (limited to 'main/loader.c')
-rw-r--r-- | main/loader.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/main/loader.c b/main/loader.c index 5d644ed6b..b14914acb 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1484,10 +1484,12 @@ struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, in void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func) { - if (!mod->flags.keepuntilshutdown) { - __ast_module_ref(mod, file, line, func); - mod->flags.keepuntilshutdown = 1; + if (!mod || mod->flags.keepuntilshutdown) { + return; } + + __ast_module_ref(mod, file, line, func); + mod->flags.keepuntilshutdown = 1; } void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func) |