gsturi: Set GError if uri is invalid

GError should be set if function call failed and the failed reason is
not a programmer error.

Fixed: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1380
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/816>
This commit is contained in:
Zhao, Gang 2021-05-09 11:45:49 +08:00 committed by GStreamer Marge Bot
parent ed92fb2430
commit 2936448f1a

View file

@ -638,6 +638,8 @@ gst_element_make_from_uri (const GstURIType type, const gchar * uri,
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!gst_uri_is_valid (uri)) {
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
_("Invalid URI: %s"), uri);
return NULL;
}
@ -809,6 +811,8 @@ gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri,
g_return_val_if_fail (iface->set_uri != NULL, FALSE);
if (!gst_uri_is_valid (uri)) {
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
_("Invalid URI: %s"), uri);
return FALSE;
}