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