summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2022-10-04 21:35:49 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2022-10-04 21:37:58 +0000
commit737ca7de91ff15c95f163bb6f133ddeb9c3221d7 (patch)
treec73838091b7d78ff0095a1293af46f4fecb6eb27
parentf5a51089d8418821d6175e82e7adad5f7919f68a (diff)
downloadglib-737ca7de91ff15c95f163bb6f133ddeb9c3221d7.tar.gz
gdatetime: add missing g_return_() check in g_date_time_format_iso8601
A clear warning is better than a NULL pointer dereference. Signed-off-by: Aleksander Morgado <aleksandermj@chromium.org>
-rw-r--r--glib/gdatetime.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index f239da183..db746564d 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -3497,6 +3497,8 @@ g_date_time_format_iso8601 (GDateTime *datetime)
gint64 offset;
gchar *format = "%C%y-%m-%dT%H:%M:%S";
+ g_return_val_if_fail (datetime != NULL, NULL);
+
/* if datetime has sub-second non-zero values below the second precision we
* should print them as well */
if (datetime->usec % G_TIME_SPAN_SECOND != 0)