[glib: 1/2] Add handling of NULL time_t* pointer as argument




commit 0a6d815f95136fa4a7319c7a724367ed3a0c2777
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Tue Feb 22 23:34:09 2022 +0100

    Add handling of NULL time_t* pointer as argument

 glib/gtimer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/glib/gtimer.c b/glib/gtimer.c
index 7d21ba822..1e7cad4d7 100644
--- a/glib/gtimer.c
+++ b/glib/gtimer.c
@@ -294,7 +294,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 void 
 g_time_val_add (GTimeVal *time_, glong microseconds)
 {
-  g_return_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC);
+  g_return_if_fail (time_ != NULL &&
+                    time_->tv_usec >= 0 &&
+                    time_->tv_usec < G_USEC_PER_SEC);
 
   if (microseconds >= 0)
     {
@@ -603,7 +605,9 @@ g_time_val_to_iso8601 (GTimeVal *time_)
 #endif
   time_t secs;
 
-  g_return_val_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC, NULL);
+  g_return_val_if_fail (time_ != NULL &&
+                        time_->tv_usec >= 0 &&
+                        time_->tv_usec < G_USEC_PER_SEC, NULL);
 
   secs = time_->tv_sec;
 #ifdef _WIN32


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