[tracker/tracker-0.6] Fixes NB#135190, assertion `GST_VALUE_HOLDS_FRACTION (value)' failed



commit 8eaddb403da7d4ec070a7251aa1f618e9e18ca15
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Tue Sep 1 13:58:12 2009 +0300

    Fixes NB#135190, assertion `GST_VALUE_HOLDS_FRACTION (value)' failed
    
    Added checks for fraction-type fields.

 src/tracker-extract/tracker-extract-gstreamer.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 9255181..be14243 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -237,19 +237,22 @@ add_fraction_gst_tag (GHashTable	*metadata,
 		      GstTagList	*tag_list,
 		      const gchar       *tag)
 {
-	gboolean ret;
 	GValue	 n = {0,};
-	gfloat   f;
 
-	ret = gst_tag_list_copy_value (&n, tag_list, tag);
+	if (gst_tag_list_copy_value (&n, tag_list, tag)) {
 
-	f = (gfloat)gst_value_get_fraction_numerator (&n)/
-		gst_value_get_fraction_denominator (&n);
+		if (GST_VALUE_HOLDS_FRACTION (&n)) {
+			gfloat f;
 
-	if (ret) {
-		g_hash_table_insert (metadata,
-				     g_strdup (key),
-				     tracker_escape_metadata_printf ("%f", f));
+			f = (gfloat)gst_value_get_fraction_numerator (&n)/
+				gst_value_get_fraction_denominator (&n);
+
+			g_hash_table_insert (metadata,
+					     g_strdup (key),
+					     tracker_escape_metadata_printf ("%f", f));
+		}
+		
+		g_value_unset (&n);
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]