mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Revert "structure: don't check type twice"
This reverts commit f864187bf5
.
Reverting this as it changes behaviour and the documentation is
ambiguous about whether the caller must check the type first or
not (call must check type vs. returns NULL if not a string). If
GLib has been compiled with G_DISABLE_CHECKS then g_value_get_string()
may return complete garbage even if the value does not contain
a string. Better play it safe, esp. since the extra check is just
an integer comparison. For fundamental types we could return values
from the GValue structure directly if we really wanted to bypass
the extra check.
This commit is contained in:
parent
f864187bf5
commit
ab5f2f4f5d
1 changed files with 2 additions and 0 deletions
|
@ -1404,6 +1404,8 @@ gst_structure_get_string (const GstStructure * structure,
|
|||
|
||||
if (field == NULL)
|
||||
return NULL;
|
||||
if (!G_VALUE_HOLDS_STRING (&field->value))
|
||||
return NULL;
|
||||
|
||||
return g_value_get_string (&field->value);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue