From c7394c34cb7581f46ad38cfac54b640848252246 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 1 Dec 2017 15:13:38 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20download=20avatar=20if=20it=20i?= =?UTF-8?q?s=20NULL=20in=20test-api-client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test-api-client.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/test-api-client.c b/src/test-api-client.c index 001547a..8ab4600 100644 --- a/src/test-api-client.c +++ b/src/test-api-client.c @@ -84,17 +84,18 @@ get_presence_finished(MatrixAPI *api, g_info("Avatar URL: %s", avatar_url); - avatar_uri = soup_uri_new(avatar_url); - g_info("Scheme: %s; authority: %s; path: %s", - soup_uri_get_scheme(avatar_uri), - soup_uri_get_host(avatar_uri), - soup_uri_get_path(avatar_uri)); - matrix_api_media_download(api, - soup_uri_get_host(avatar_uri), - soup_uri_get_path(avatar_uri) + 1, - NULL, NULL, - NULL); - soup_uri_free(avatar_uri); + if ((avatar_uri = soup_uri_new(avatar_url)) != NULL) { + g_info("Scheme: %s; authority: %s; path: %s", + soup_uri_get_scheme(avatar_uri), + soup_uri_get_host(avatar_uri), + soup_uri_get_path(avatar_uri)); + matrix_api_media_download(api, + soup_uri_get_host(avatar_uri), + soup_uri_get_path(avatar_uri) + 1, + NULL, NULL, + NULL); + soup_uri_free(avatar_uri); + } } static void