diff options
Diffstat (limited to 'toxcore/network.c')
-rw-r--r-- | toxcore/network.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index e5a80254..82f29aef 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -310,9 +310,12 @@ typedef struct { | |||
310 | 310 | ||
311 | int networking_wait_prepare(Networking_Core *net, uint32_t sendqueue_length, uint8_t *data, uint16_t *lenptr) | 311 | int networking_wait_prepare(Networking_Core *net, uint32_t sendqueue_length, uint8_t *data, uint16_t *lenptr) |
312 | { | 312 | { |
313 | if ((data == NULL) || (*lenptr < sizeof(select_info))) { | 313 | if ((data == NULL) || !lenptr || (*lenptr < sizeof(select_info))) { |
314 | *lenptr = sizeof(select_info); | 314 | if (lenptr) { |
315 | return 0; | 315 | *lenptr = sizeof(select_info); |
316 | return 0; | ||
317 | } else | ||
318 | return -1; | ||
316 | } | 319 | } |
317 | 320 | ||
318 | *lenptr = sizeof(select_info); | 321 | *lenptr = sizeof(select_info); |