mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-06-03 10:31:16 +00:00
Avoid unknown command errors when parsing settings early
This commit is contained in:
parent
9bb048f27f
commit
20ff3f866c
1 changed files with 23 additions and 9 deletions
|
@ -4338,11 +4338,15 @@ fluid_cmd_handler_t *new_fluid_cmd_handler2(fluid_settings_t* settings, fluid_sy
|
||||||
(is_settings_cmd && settings == NULL) ||
|
(is_settings_cmd && settings == NULL) ||
|
||||||
(!is_router_cmd && !is_settings_cmd && synth == NULL))
|
(!is_router_cmd && !is_settings_cmd && synth == NULL))
|
||||||
{
|
{
|
||||||
/* omit registering router and synth commands if they were not requested */
|
/* register a no-op command, this avoids an unknown command error later on */
|
||||||
continue;
|
fluid_cmd_t noop = *cmd;
|
||||||
|
noop.handler = NULL;
|
||||||
|
fluid_cmd_handler_register(handler, &noop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fluid_cmd_handler_register(handler, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
fluid_cmd_handler_register(handler, &fluid_commands[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
|
@ -4398,13 +4402,23 @@ fluid_cmd_handler_handle(void *data, int ac, char **av, fluid_ostream_t out)
|
||||||
|
|
||||||
cmd = fluid_hashtable_lookup(handler->commands, av[0]);
|
cmd = fluid_hashtable_lookup(handler->commands, av[0]);
|
||||||
|
|
||||||
if(cmd && cmd->handler)
|
if(cmd)
|
||||||
{
|
{
|
||||||
return (*cmd->handler)(handler, ac - 1, av + 1, out);
|
if(cmd->handler)
|
||||||
|
{
|
||||||
|
return (*cmd->handler)(handler, ac - 1, av + 1, out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* no-op command */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fluid_ostream_printf(out, "unknown command: %s (try help)\n", av[0]);
|
||||||
|
return FLUID_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
fluid_ostream_printf(out, "unknown command: %s (try help)\n", av[0]);
|
|
||||||
return FLUID_FAILED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue