diff options
author | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2011-01-24 23:32:30 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2011-01-24 23:51:53 -0300 |
commit | a875342c54c470c75e53f9a30b810b7af859813e (patch) | |
tree | ef5f182578aef25c5ee15ef543fbdb9b43370417 | |
parent | 97789fa5bcb9ed48ca2aaacbc7e5ee7da84b8e99 (diff) |
rsvgoverlay: Do not segfault on unexistent files
When passing an unexistent file to rsvgoverlay it would
crash because the svg loading would fail without setting
an error.
This patch makes it check if the handle was actually created
and logs an error in case it didn't. Maybe it should post an
error to the bus, but the previous error handling didn't, so
I just followed the same logic.
-rw-r--r-- | ext/rsvg/gstrsvgoverlay.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/rsvg/gstrsvgoverlay.c b/ext/rsvg/gstrsvgoverlay.c index 60fd1676d..2a5bdc10d 100644 --- a/ext/rsvg/gstrsvgoverlay.c +++ b/ext/rsvg/gstrsvgoverlay.c @@ -126,10 +126,14 @@ gst_rsvg_overlay_set_svg_data (GstRsvgOverlay * overlay, const gchar * data, else overlay->handle = rsvg_handle_new_from_data ((guint8 *) data, size, &error); - if (error) { - GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s\n%s", - error->message, data); - g_error_free (error); + if (error || overlay->handle == NULL) { + if (error) { + GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s\n%s", + error->message, data); + g_error_free (error); + } else { + GST_ERROR_OBJECT (overlay, "Cannot read SVG data: %s", data); + } } else { /* Get SVG dimension. */ RsvgDimensionData svg_dimension; |