From 01e6684e8851e16ebbbf9b46f9ff073d16d2e9e7 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 26 Nov 2018 18:01:47 +0200 Subject: [PATCH] shared/timeout-glib: Check 0 id when removing timeout If the id is 0 that makes it is invalid already. --- src/shared/timeout-glib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/timeout-glib.c b/src/shared/timeout-glib.c index 4163bced7..fd71ca430 100644 --- a/src/shared/timeout-glib.c +++ b/src/shared/timeout-glib.c @@ -71,8 +71,12 @@ unsigned int timeout_add(unsigned int timeout, timeout_func_t func, void timeout_remove(unsigned int id) { - GSource *source = g_main_context_find_source_by_id(NULL, id); + GSource *source; + if (!id) + return; + + source = g_main_context_find_source_by_id(NULL, id); if (source) g_source_destroy(source); } -- 2.47.3