From 0a6d815f95136fa4a7319c7a724367ed3a0c2777 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 22 Feb 2022 23:34:09 +0100 Subject: [PATCH] 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