Skip to content

Commit b8ce394

Browse files
committed
fix: Null function pointer dereference.
1 parent 2760966 commit b8ce394

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

toxcore/tox.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ static void tox_log_handler(void *context, Logger_Level level, const char *file,
115115
{
116116
Tox *tox = (Tox *)context;
117117
assert(tox != nullptr);
118-
tox->log_callback(tox, (Tox_Log_Level)level, file, line, func, message, userdata);
118+
119+
if (tox->log_callback != nullptr) {
120+
tox->log_callback(tox, (Tox_Log_Level)level, file, line, func, message, userdata);
121+
}
119122
}
120123

121124
static m_self_connection_status_cb tox_self_connection_status_handler;

0 commit comments

Comments
 (0)