validate-scenario: Handle switching stream of type not present

Unlikely to happen, but at least don't end up doing unsafe calculation
with n == 0 afterwards

CID #1415453
This commit is contained in:
Edward Hervey 2017-11-22 16:34:42 +01:00 committed by Edward Hervey
parent aa7f753f8a
commit 81c3ab0b12

View file

@ -1250,6 +1250,11 @@ switch_stream (GstValidatePipelineMonitor * monitor, GstValidateAction * action,
}
}
if (G_UNLIKELY (n == 0)) {
GST_ERROR ("No streams available of the required type");
return result;
}
if (relative) { /* We are changing track relatively to current track */
index = (current + index) % n;
}