[recipes] Avoid a crash in the new image loading code
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Avoid a crash in the new image loading code
- Date: Sun, 9 Apr 2017 04:01:28 +0000 (UTC)
commit ddd4ec6527261d8c17c2d6a6af890d7d4fae6f39
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 8 23:59:55 2017 -0400
Avoid a crash in the new image loading code
This was crashing when saving a recipe after deleting
an image.
src/gr-image.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/gr-image.c b/src/gr-image.c
index a273bc0..ba759c6 100644
--- a/src/gr-image.c
+++ b/src/gr-image.c
@@ -281,9 +281,6 @@ set_modified_request (SoupMessage *msg,
{
g_autoptr(GFile) file = NULL;
g_autoptr(GFileInfo) info = NULL;
- GTimeVal tv;
- g_autoptr(GDateTime) mtime = NULL;
- g_autofree char *mod_date = NULL;
file = g_file_new_for_path (path);
info = g_file_query_info (file,
@@ -291,11 +288,16 @@ set_modified_request (SoupMessage *msg,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
+ if (info) {
+ GTimeVal tv;
+ g_autoptr(GDateTime) mtime = NULL;
+ g_autofree char *mod_date = NULL;
- g_file_info_get_modification_time (info, &tv);
- mtime = g_date_time_new_from_timeval_utc (&tv);
- mod_date = g_date_time_format (mtime, "%a, %d %b %Y %H:%M:%S %Z");
- soup_message_headers_append (msg->request_headers, "If-Modified-Since", mod_date);
+ g_file_info_get_modification_time (info, &tv);
+ mtime = g_date_time_new_from_timeval_utc (&tv);
+ mod_date = g_date_time_format (mtime, "%a, %d %b %Y %H:%M:%S %Z");
+ soup_message_headers_append (msg->request_headers, "If-Modified-Since", mod_date);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]