streams: gst_stream_type_get_name() is not nullable

It takes an enum and only the defined values are valid to pass in here
as it's not extensible from the outside.

Add a g_return_val_if_reached() for the unreachable case and return
"invalid".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/713>
This commit is contained in:
Sebastian Dröge 2020-12-02 09:22:35 +02:00 committed by Tim-Philipp Müller
parent 12937488ae
commit 877f2b6800

View file

@ -543,7 +543,7 @@ gst_stream_get_property (GObject * object, guint prop_id,
*
* Get a descriptive string for a given #GstStreamType
*
* Returns: (nullable): A string describing the stream type
* Returns: A string describing the stream type
*
* Since: 1.10
*/
@ -563,8 +563,7 @@ gst_stream_type_get_name (GstStreamType stype)
case GST_STREAM_TYPE_TEXT:
return "text";
default:
return NULL;
g_return_val_if_reached ("invalid");
return "invalid";
}
return NULL;
}