From 7e262c06c7ec2457f84a19c4a1fdbb49aa8577a3 Mon Sep 17 00:00:00 2001 From: Fei Deng Date: Wed, 21 Aug 2019 14:19:25 -0500 Subject: [PATCH] check for nullptr when locking --- iocore/eventsystem/I_Lock.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iocore/eventsystem/I_Lock.h b/iocore/eventsystem/I_Lock.h index b5bef2c40e0..d599be26b06 100644 --- a/iocore/eventsystem/I_Lock.h +++ b/iocore/eventsystem/I_Lock.h @@ -353,17 +353,19 @@ class MutexLock Ptr &am, EThread *t) : m(am), locked_p(true) { - Mutex_lock( + if (am) { + Mutex_lock( #ifdef DEBUG - location, ahandler, + location, ahandler, #endif // DEBUG - m, t); + m, t); + } } void release() { - if (locked_p) { + if (locked_p && m) { Mutex_unlock(m, m->thread_holding); } locked_p = false;