vp9enc: Don't dereference NULL checks

CID #1197703
This commit is contained in:
Edward Hervey 2014-05-20 08:20:42 +02:00 committed by Edward Hervey
parent b4a129ad71
commit eb30edae9f

View file

@ -909,18 +909,18 @@ gst_vp9_enc_set_property (GObject * object, guint prop_id,
memset (&gst_vp9_enc->cfg.ts_rate_decimator, 0, memset (&gst_vp9_enc->cfg.ts_rate_decimator, 0,
sizeof (gst_vp9_enc->cfg.ts_rate_decimator)); sizeof (gst_vp9_enc->cfg.ts_rate_decimator));
if (va->n_values > VPX_TS_MAX_LAYERS) { if (va == NULL) {
gst_vp9_enc->n_ts_rate_decimator = 0;
} else if (va->n_values > VPX_TS_MAX_LAYERS) {
g_warning ("%s: Only %d layers allowed at maximum", g_warning ("%s: Only %d layers allowed at maximum",
GST_ELEMENT_NAME (gst_vp9_enc), VPX_TS_MAX_LAYERS); GST_ELEMENT_NAME (gst_vp9_enc), VPX_TS_MAX_LAYERS);
} else if (va) { } else {
gint i; gint i;
for (i = 0; i < va->n_values; i++) for (i = 0; i < va->n_values; i++)
gst_vp9_enc->cfg.ts_rate_decimator[i] = gst_vp9_enc->cfg.ts_rate_decimator[i] =
g_value_get_int (g_value_array_get_nth (va, i)); g_value_get_int (g_value_array_get_nth (va, i));
gst_vp9_enc->n_ts_rate_decimator = va->n_values; gst_vp9_enc->n_ts_rate_decimator = va->n_values;
} else {
gst_vp9_enc->n_ts_rate_decimator = 0;
} }
global = TRUE; global = TRUE;
break; break;