From 70423655d29d6dfb4d81ff760e438aea08c28e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Tue, 23 May 2017 14:38:48 +0200 Subject: [PATCH] Low: loop: don't bring runtime down for a trivial API misuse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- lib/loop.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/loop.c b/lib/loop.c index 76fd0b7..e6a19c7 100644 --- a/lib/loop.c +++ b/lib/loop.c @@ -128,10 +128,11 @@ qb_loop_destroy(struct qb_loop *l) void qb_loop_stop(struct qb_loop *l) { - if (l == NULL) { - default_instance->stop_requested = QB_TRUE; + struct qb_loop *apply_loop = (l != NULL) ? l : default_instance; + if (apply_loop != NULL) { + apply_loop->stop_requested = QB_TRUE; } else { - l->stop_requested = QB_TRUE; + qb_util_log(LOG_CRIT, "API misuse: cannot stop nonexisting loop"); } }