diff options
author | Ondřej Hruška <ondra@ondrovo.com> | 2020-03-22 09:47:35 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-06-04 22:59:10 +0000 |
commit | 7b0e6f3e62f052d46fc9b46d3adf2483335518be (patch) | |
tree | b07ef17b29446f4dd52b072556a1da97636ce447 /gst/gstdatetime.c | |
parent | 687c0f0ce712e74a450a8392409d65a0137df63a (diff) |
gstdatetime: Add missing NULL check to gst_date_time_new_local_time
Also add a unit test for this.
Fixes #524
Diffstat (limited to 'gst/gstdatetime.c')
-rw-r--r-- | gst/gstdatetime.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c index 6d6e7c855d..2cea67169e 100644 --- a/gst/gstdatetime.c +++ b/gst/gstdatetime.c @@ -520,6 +520,9 @@ gst_date_time_new_local_time (gint year, gint month, gint day, gint hour, datetime = gst_date_time_new_from_g_date_time (g_date_time_new_local (year, month, day, hour, minute, seconds)); + if (datetime == NULL) + return NULL; + datetime->fields = fields; return datetime; } @@ -644,6 +647,9 @@ gst_date_time_new (gfloat tzoffset, gint year, gint month, gint day, gint hour, dt = g_date_time_new (tz, year, month, day, hour, minute, seconds); g_time_zone_unref (tz); + if (!dt) + return NULL; /* date failed validation */ + datetime = gst_date_time_new_from_g_date_time (dt); datetime->fields = fields; |