1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-25 19:53:02 +01:00

fix segfault on starting video

This commit is contained in:
zugz (tox) 2020-04-11 00:00:00 +00:00
parent 6f72a191ba
commit 610906d07f
No known key found for this signature in database
GPG Key ID: 6F2BDA289D04F249

View File

@ -223,7 +223,6 @@ void callback_recv_video_end(uint32_t friend_number)
} }
void callback_video_starting(uint32_t friend_number) void callback_video_starting(uint32_t friend_number)
{ {
ToxWindow *windows = CallControl.prompt;
Call *this_call = &CallControl.calls[friend_number]; Call *this_call = &CallControl.calls[friend_number];
Toxav_Err_Call_Control error = TOXAV_ERR_CALL_CONTROL_OK; Toxav_Err_Call_Control error = TOXAV_ERR_CALL_CONTROL_OK;
@ -233,13 +232,15 @@ void callback_video_starting(uint32_t friend_number)
size_t i; size_t i;
for (i = 0; i < MAX_WINDOWS_NUM; ++i) { for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i].is_call && windows[i].num == friend_number) { ToxWindow *window = get_window_ptr(i);
if (0 != start_video_transmission(&windows[i], CallControl.av, this_call)) {
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0, "Error starting transmission!"); if (window != NULL && window->is_call && window->num == friend_number) {
if (0 != start_video_transmission(window, CallControl.av, this_call)) {
line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Error starting transmission!");
return; return;
} }
line_info_add(&windows[i], NULL, NULL, NULL, SYS_MSG, 0, 0, "Video capture starting."); line_info_add(window, NULL, NULL, NULL, SYS_MSG, 0, 0, "Video capture starting.");
} }
} }
} }