From dbad6f7061662d0b5b19b8012c99f850bb96091e Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 17 Mar 2014 00:54:00 +0100 Subject: [PATCH] hw: don't use assert in Kernel::bin_thread ref #1101 --- base-hw/src/core/kernel/thread.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/base-hw/src/core/kernel/thread.cc b/base-hw/src/core/kernel/thread.cc index fa2d6e8f3..2475967b6 100644 --- a/base-hw/src/core/kernel/thread.cc +++ b/base-hw/src/core/kernel/thread.cc @@ -334,13 +334,16 @@ void Thread::_call_new_thread() void Thread::_call_bin_thread() { /* check permissions */ - assert(_core()); - - /* get targeted thread */ - unsigned thread_id = (unsigned)user_arg_1(); - Thread * const thread = Thread::pool()->object(thread_id); - assert(thread); - + if (!_core()) { + PWRN("not entitled to bin thread"); + return; + } + /* lookup thread */ + Thread * const thread = Thread::pool()->object(user_arg_1()); + if (!thread) { + PWRN("failed to lookup thread"); + return; + } /* destroy thread */ thread->~Thread(); }