From 1b5b6eccb50abf0aa1ae5fb61222b33571b64f03 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Sun, 21 Sep 2014 17:30:18 +0100 Subject: [PATCH] Do not crash trying to call commands on an empty master effect slot. --- module.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/module.c b/module.c index 953750f..5c5986c 100644 --- a/module.c +++ b/module.c @@ -231,13 +231,13 @@ gboolean cbox_module_slot_process_cmd(struct cbox_module **psm, cbox_rt_swap_pointers(rt, (void **)psm, effect); return TRUE; } + if (!sm) + { + g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "No engine on module in path '%s'", cmd->command); + return FALSE; + } if (!strncmp(subcmd, "/engine/", 8)) { - if (!sm) - { - g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "No engine on module in path '%s'", cmd->command); - return FALSE; - } if (!sm->cmd_target.process_cmd) { g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "The engine %s has no command target defined", sm->engine_name); @@ -247,11 +247,6 @@ gboolean cbox_module_slot_process_cmd(struct cbox_module **psm, } if (!strcmp(subcmd, "/set_bypass") && !strcmp(cmd->arg_types, "i")) { - if (!sm) - { - g_set_error(error, CBOX_MODULE_ERROR, CBOX_MODULE_ERROR_FAILED, "No engine on module in path '%s'", cmd->command); - return FALSE; - } sm->bypass = CBOX_ARG_I(cmd, 0); return TRUE; } -- 2.11.4.GIT