From 97820be04836873cca98fddf52c1901e430d9bee Mon Sep 17 00:00:00 2001 From: Cloudwalk Date: Sat, 18 Sep 2021 23:42:58 -0400 Subject: [PATCH] cmd: Check for empty cbuf when inserting too --- cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd.c b/cmd.c index e8f16889..a12fae8e 100644 --- a/cmd.c +++ b/cmd.c @@ -394,7 +394,7 @@ void Cbuf_InsertText (cmd_state_t *cmd, const char *text) Con_Print("Cbuf_InsertText: overflow\n"); else { - Cbuf_LinkCreate(cmd, &llist, List_Entry(cbuf->start.next, cmd_input_t, list), text); + Cbuf_LinkCreate(cmd, &llist, (List_Is_Empty(&cbuf->start) ? NULL : List_Entry(cbuf->start.next, cmd_input_t, list)), text); if(!List_Is_Empty(&llist)) List_Splice(&llist, &cbuf->start); } -- 2.39.2