From 572b59d4174639775d327532bc865c8b8665ed69 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 22 Mar 2015 00:29:30 +0100 Subject: [PATCH] Robustness fixes --- retroarch.c | 5 ++++- runloop.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/retroarch.c b/retroarch.c index cf8da76a9c..9f24d83715 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1668,7 +1668,10 @@ static void free_temporary_content(void) static void main_clear_state_drivers(void) { global_t *global = global_get_ptr(); - bool inited = global->main_is_init; + bool inited = false; + if (!global) + return; + inited = global->main_is_init; if (!inited) return; diff --git a/runloop.c b/runloop.c index b9a427d306..5fcd5e9c4e 100644 --- a/runloop.c +++ b/runloop.c @@ -981,6 +981,9 @@ void rarch_main_msg_queue_push(const char *msg, unsigned prio, unsigned duration void rarch_main_msg_queue_free(void) { runloop_t *runloop = rarch_main_get_ptr(); + if (!runloop) + return; + if (runloop->msg_queue) msg_queue_free(runloop->msg_queue); runloop->msg_queue = NULL; @@ -989,6 +992,9 @@ void rarch_main_msg_queue_free(void) void rarch_main_msg_queue_init(void) { runloop_t *runloop = rarch_main_get_ptr(); + if (!runloop) + return; + if (!runloop->msg_queue) rarch_assert(runloop->msg_queue = msg_queue_new(8)); }