From c1406fa5ecae775809eaefb027588e9122451e50 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 27 Sep 2025 07:39:43 -0400 Subject: [PATCH] command: fix null dereference for invalid command in input-commands mp_input_parse_cmd can return NULL. --input-commands=x segfaults with null dereference. Fix this by adding null check. Fixes: 533a6843811573a862de47b424fe5bf7ad71f85e --- player/command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/player/command.c b/player/command.c index 73cf519df0..9a378f76df 100644 --- a/player/command.c +++ b/player/command.c @@ -7789,8 +7789,10 @@ void run_command_opts(struct MPContext *mpctx) for (int i = 0; opts->input_commands[i]; i++) { struct mp_cmd *cmd = mp_input_parse_cmd(mpctx->input, bstr0(opts->input_commands[i]), "the command line"); - cmd->coalesce = true; - mp_input_queue_cmd(mpctx->input, cmd); + if (cmd) { + cmd->coalesce = true; + mp_input_queue_cmd(mpctx->input, cmd); + } } ctx->command_opts_processed = true; }