diff options
author | Jens Georg <mail@jensge.org> | 2022-05-25 09:42:30 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2022-05-25 09:42:30 +0200 |
commit | a64e398fb2471664746aaf3199acb708c103b85a (patch) | |
tree | 5a888ecff2a0b6911d077368a5b306ff1876e638 | |
parent | 09dfcdc65568859b13b38406088c0ccd2768824a (diff) | |
download | gupnp-tools-a64e398fb2471664746aaf3199acb708c103b85a.tar.gz |
common: Do not dereference NULL error
-rw-r--r-- | src/common/icons.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/icons.c b/src/common/icons.c index e8fa308..381157d 100644 --- a/src/common/icons.c +++ b/src/common/icons.c @@ -92,9 +92,6 @@ on_got_icon (GObject *source, GAsyncResult *res, gpointer user_data) { GError *error = NULL; g_autoptr (GTask) task = G_TASK (user_data); - SoupMessage *message = - soup_session_get_async_result_message (SOUP_SESSION (source), - res); g_autoptr (GBytes) body = soup_session_send_and_read_finish (SOUP_SESSION (source), @@ -107,13 +104,17 @@ on_got_icon (GObject *source, GAsyncResult *res, gpointer user_data) return; } + SoupMessage *message = + soup_session_get_async_result_message (SOUP_SESSION (source), + res); + if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (message))) { g_task_return_error ( task, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "Unable to download icon: %s", - error->message)); + soup_message_get_reason_phrase (message))); return; } |