[gnome-documents] utils: be robust against NULL mtime strings



commit 715396e3eb2db5e62c78631321da45585c3c8c3e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jan 16 13:58:52 2012 -0500

    utils: be robust against NULL mtime strings
    
    We should never fetch an empty mtime string from the database, but in
    case it happens, returning the current time is better than crashing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667892

 src/lib/gd-utils.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index 41a7678..75cfbb2 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -395,7 +395,7 @@ gd_filename_strip_extension (const char * filename_with_extension)
 
 /**
  * gd_time_val_from_iso8601:
- * @string:
+ * @string: (allow-none):
  * @timeval: (out):
  *
  * Returns:
@@ -404,6 +404,9 @@ gboolean
 gd_time_val_from_iso8601 (const gchar *string,
                           GTimeVal *timeval)
 {
+  if (string == NULL)
+    g_get_current_time (timeval);
+
   return g_time_val_from_iso8601 (string, timeval);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]