From: Cloudwalk Date: Sun, 19 Sep 2021 03:42:58 +0000 (-0400) Subject: cmd: Check for empty cbuf when inserting too X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=97820be04836873cca98fddf52c1901e430d9bee;hp=0303750a7b40951618dca290c172a7afa60e9aa8 cmd: Check for empty cbuf when inserting too --- 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); }