Skip to content

Commit

Permalink
streams: gst_stream_type_get_name() is not nullable
Browse files Browse the repository at this point in the history
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/711>
  • Loading branch information
sdroege committed Dec 2, 2020
1 parent b72f379 commit 7bd73a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gst/gststreams.c
Expand Up @@ -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
*/
Expand All @@ -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;
}

0 comments on commit 7bd73a5

Please sign in to comment.