From 3528923507685512e90d4fb80f506e3ee2fca088 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 2 Jan 2018 13:41:59 +0100 Subject: [PATCH] Fix crash with Linux HTTP tasks - null pointer dereference --- gfx/video_display_server.c | 11 ++++++++--- tasks/task_http.c | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index eb430fa01f..b0841ec0fe 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -46,7 +46,8 @@ void* video_display_server_init(void) current_display_server_data = current_display_server->init(); - RARCH_LOG("[Video]: Found display server: %s\n", current_display_server->ident); + RARCH_LOG("[Video]: Found display server: %s\n", + current_display_server->ident); return current_display_server_data; } @@ -58,10 +59,14 @@ void video_display_server_destroy(void) bool video_display_server_set_window_opacity(unsigned opacity) { - return current_display_server->set_window_opacity(current_display_server_data, opacity); + if (current_display_server && current_display_server->set_window_opacity) + return current_display_server->set_window_opacity(current_display_server_data, opacity); + return false; } bool video_display_server_set_window_progress(int progress, bool finished) { - return current_display_server->set_window_progress(current_display_server_data, progress, finished); + if (current_display_server && current_display_server->set_window_progress) + return current_display_server->set_window_progress(current_display_server_data, progress, finished); + return false; } diff --git a/tasks/task_http.c b/tasks/task_http.c index eaf19a5a39..9608133854 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -237,6 +237,8 @@ static bool task_http_retriever(retro_task_t *task, void *data) static void http_transfer_progress_cb(retro_task_t *task) { + if (!task) + return; video_display_server_set_window_progress(task->progress, task->finished); }