diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 92bccadc84b67..a8db8463e8e53 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2177,7 +2177,7 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use, #ifdef WITH_WSREP { signalled|= mysql_lock_abort_for_thread(this, thd_table); - if (this && WSREP(this) && wsrep_thd_is_BF((void *)this, FALSE)) + if (WSREP(this) && wsrep_thd_is_BF((void *)this, FALSE)) { WSREP_DEBUG("remove_table_from_cache: %llu", (unsigned long long) this->real_id); diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 7f574cb996a62..5ec183f7186eb 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -207,7 +207,7 @@ extern wsrep_seqno_t wsrep_locked_seqno; strcmp(wsrep_provider, WSREP_NONE)) #define WSREP(thd) \ - (WSREP_ON && wsrep && (thd->variables.wsrep_on)) + (WSREP_ON && wsrep && (thd && thd->variables.wsrep_on)) #define WSREP_CLIENT(thd) \ (WSREP(thd) && thd->wsrep_client_thread)