mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 00:33:02 +01:00
Check if pointer is null before accessing
This commit is contained in:
parent
b7d67c1d86
commit
9e3d4f3889
@ -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);
|
length = copy_tox_str(msg, sizeof(msg), (const char *) data, length);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
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);
|
windows[i]->onFriendRequest(windows[i], m, (const char *) public_key, msg, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user