[tracker-miners/tracker-miners-2.2] tracker-extract-gstreamer.c: Set empty tags list if no tags were found



commit e12bb09b86edaec967d8256f6b0f26b47c6ac21d
Author: nightuser <22158-nightuser users noreply gitlab gnome org>
Date:   Sat Jul 13 18:21:16 2019 +0300

    tracker-extract-gstreamer.c: Set empty tags list if no tags were found
    
    If entry doesn't has tags then `tracker_toc_add_entry` receives NULL
    instead of the tag list. But this function immediately tries to make a
    reference to the tag list and fails on NULL pointer. And every function
    in `tracker-cue-sheet.c` assumes that the list is non-NULL.
    
    Now it creates empty tag list if an entry doesn't contain tags. It
    shouldn't have any impact since in normal case tag list is copied.
    
    See: https://gitlab.gnome.org/GNOME/tracker-miners/merge_requests/86

 src/tracker-extract/tracker-extract-gstreamer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index fa0bab66a..84e7ce78f 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -385,12 +385,14 @@ translate_discoverer_toc (GstToc *gst_toc)
 
                if (tags) {
                        copy = gst_tag_list_copy (tags);
+               } else {
+                       copy = gst_tag_list_new_empty ();
+               }
 
-                       if (gst_tag_list_get_tag_size (copy, GST_TAG_TRACK_NUMBER) == 0) {
-                               gst_tag_list_add (copy, GST_TAG_MERGE_REPLACE,
-                                                 GST_TAG_TRACK_NUMBER, i + 1,
-                                                 NULL);
-                       }
+               if (gst_tag_list_get_tag_size (copy, GST_TAG_TRACK_NUMBER) == 0) {
+                       gst_tag_list_add (copy, GST_TAG_MERGE_REPLACE,
+                                         GST_TAG_TRACK_NUMBER, i + 1,
+                                         NULL);
                }
 
                gst_toc_entry_get_start_stop_times (entry, &start, &stop);


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