From 34a5946e6bc738a6fa2681c51123cd1f6d2922f3 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 19 Mar 2014 17:02:03 +0100 Subject: [PATCH] validate-scenario: Handle non-set env variable Nothing guarantees it's present/set --- validate/gst/validate/gst-validate-scenario.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index a76d72e..82a72bc 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -618,8 +618,10 @@ get_position (GstValidateScenario * scenario) MAX (0, (gint64) (priv->segment_start - priv->seek_pos_tol)); stop_with_tolerance = priv->segment_stop != -1 ? priv->segment_stop + priv->seek_pos_tol : -1; - if ((GST_CLOCK_TIME_IS_VALID (stop_with_tolerance) && position > stop_with_tolerance) - || (priv->seek_flags & GST_SEEK_FLAG_ACCURATE && position < start_with_tolerance)) { + if ((GST_CLOCK_TIME_IS_VALID (stop_with_tolerance) + && position > stop_with_tolerance) + || (priv->seek_flags & GST_SEEK_FLAG_ACCURATE + && position < start_with_tolerance)) { GST_VALIDATE_REPORT (scenario, QUERY_POSITION_OUT_OF_SEGMENT, "Current position %" GST_TIME_FORMAT " not in the expected range [%" @@ -1305,14 +1307,17 @@ gst_validate_list_scenarios (gchar * output_file) gsize datalength; GError *err = NULL; GKeyFile *kf = NULL; - gchar **env_scenariodir = - g_strsplit (g_getenv ("GST_VALIDATE_SCENARIOS_PATH"), ":", - 0); + const gchar *envvar; + gchar **env_scenariodir = NULL; gchar *tldir = g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_API_VERSION, GST_VALIDATE_SCENARIO_DIRECTORY, NULL); GFile *dir = g_file_new_for_path (tldir); + envvar = g_getenv ("GST_VALIDATE_SCENARIOS_PATH"); + if (envvar) + env_scenariodir = g_strsplit (envvar, ":", 0); + kf = g_key_file_new (); _list_scenarios_in_dir (dir, kf); g_object_unref (dir); -- 2.7.4