GNOME Bugzilla – Bug 768450
pad: check caps not NULL before referring
Last modified: 2016-07-25 10:26:55 UTC
We have to check that caps are not NULL before referring
Created attachment 330909 [details] [review] pad: check caps not NULL before referring
Review of attachment 330909 [details] [review]: ::: gst/gstpad.c @@ +2759,2 @@ query = gst_query_new_caps (mycaps); gst_pad_peer_query (pad, query); It should rather check if this returns TRUE or not. If it does, we use the caps (and they must be non-NULL). Otherwise we just go out.
Review of attachment 330909 [details] [review]: ::: gst/gstpad.c @@ +2759,2 @@ query = gst_query_new_caps (mycaps); gst_pad_peer_query (pad, query); Could someone answer the query caps with NULL?
If the query returns TRUE, no. It would be possible of course but it would be a programming mistake (so maybe make it a g_warn_if_fail() or similar).
Created attachment 330914 [details] [review] pad: check query caps answered and caps not NULL
Review of attachment 330914 [details] [review]: ::: gst/gstpad.c @@ +2767,3 @@ + gst_caps_ref (caps); + } else { + g_warning ("Caps are NULL"); That's not useful information when printed later :) Make this a "g_warn_if_fail (caps != NULL)", which is a double-check then but will print the assertion and also source file and line.
Created attachment 330933 [details] [review] pad: check query caps answered and caps not NULL
Attachment 330933 [details] pushed as 9f982e2 - pad: check query caps answered and caps not NULL