From a71a52ddd646cd46ee93cbe55a7dee450aac37c0 Mon Sep 17 00:00:00 2001 From: BrandonSchaefer Date: Mon, 10 Nov 2014 12:17:21 -0800 Subject: [PATCH] Check queue == NULL if we can't connect to server. --- src/mir_window.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mir_window.c b/src/mir_window.c index 8dd033b5..530d38de 100644 --- a/src/mir_window.c +++ b/src/mir_window.c @@ -427,18 +427,23 @@ void _glfwInitEventQueue(EventQueue* queue) void _glfwDeleteEventQueue(EventQueue* queue) { - EventNode* node, *node_next; - node = queue->head.tqh_first; - - while (node != NULL) + if (queue) { - node_next = node->entries.tqe_next; + EventNode* node, *node_next; + node = queue->head.tqh_first; - TAILQ_REMOVE(&queue->head, node, entries); - deleteNode(queue, node); + while (node != NULL) + { + node_next = node->entries.tqe_next; - node = node_next; + TAILQ_REMOVE(&queue->head, node, entries); + deleteNode(queue, node); + + node = node_next; + } } + + free(queue); } //////////////////////////////////////////////////////////////////////////