Add handling of NULL time_t* pointer as argument

This commit is contained in:
Emmanuel Fleury 2022-02-22 23:34:09 +01:00
parent 199261a419
commit 0a6d815f95

View File

@ -294,7 +294,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void void
g_time_val_add (GTimeVal *time_, glong microseconds) 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) if (microseconds >= 0)
{ {
@ -603,7 +605,9 @@ g_time_val_to_iso8601 (GTimeVal *time_)
#endif #endif
time_t secs; 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; secs = time_->tv_sec;
#ifdef _WIN32 #ifdef _WIN32