[glib: 1/2] gdatetime: add NULL guard in g_date_time_new_now()




commit 574a2ecfa9472410cf382a4fb545fe41fe0d5128
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Oct 9 19:39:58 2022 -0400

    gdatetime: add NULL guard in g_date_time_new_now()
    
    Add a missing g_return_() check in g_date_time_new_now().
    A clear warning is better than a NULL pointer dereference.

 glib/gdatetime.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index db746564d6..a9c472e557 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -959,6 +959,8 @@ g_date_time_new_now (GTimeZone *tz)
 {
   gint64 now_us;
 
+  g_return_val_if_fail (tz != NULL, NULL);
+
   now_us = g_get_real_time ();
 
   return g_date_time_new_from_unix (tz, now_us);


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