From 9e3d4f388912a4f59abf6e30cc1fadee0a58291d Mon Sep 17 00:00:00 2001 From: jfreegman Date: Sun, 28 Oct 2018 07:09:37 -0400 Subject: [PATCH] Check if pointer is null before accessing --- src/windows.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/windows.c b/src/windows.c index f3bd50e..756c76f 100644 --- a/src/windows.c +++ b/src/windows.c @@ -54,7 +54,7 @@ void on_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, s length = copy_tox_str(msg, sizeof(msg), (const char *) data, length); for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) { - if (windows[i]->onFriendRequest != NULL) { + if (windows[i] != NULL && windows[i]->onFriendRequest != NULL) { windows[i]->onFriendRequest(windows[i], m, (const char *) public_key, msg, length); } }