From b8ce394e643dad38e067b44e1e8062eaf18b0e86 Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 22 Feb 2022 01:54:26 +0000 Subject: [PATCH] fix: Null function pointer dereference. --- toxcore/tox.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/toxcore/tox.c b/toxcore/tox.c index 53bd38a4cf..70778f66db 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -115,7 +115,10 @@ static void tox_log_handler(void *context, Logger_Level level, const char *file, { Tox *tox = (Tox *)context; assert(tox != nullptr); - tox->log_callback(tox, (Tox_Log_Level)level, file, line, func, message, userdata); + + if (tox->log_callback != nullptr) { + tox->log_callback(tox, (Tox_Log_Level)level, file, line, func, message, userdata); + } } static m_self_connection_status_cb tox_self_connection_status_handler;