[rygel] media-export: avoid crash if unknown file is found
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] media-export: avoid crash if unknown file is found
- Date: Wed, 9 Sep 2009 20:40:24 +0000 (UTC)
commit 99f1b150afec96ac9ff213c085a8bc50edd67e28
Author: Jens Georg <mail jensge org>
Date: Tue Aug 11 17:54:29 2009 +0200
media-export: avoid crash if unknown file is found
Reported on IRC by "fatal" (Andreas Henriksson)
.../media-export/rygel-media-export-harvester.vala | 18 ++++++++++--------
.../media-export/rygel-media-export-item.vala | 3 ++-
2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index f656ca3..9a85340 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -297,15 +297,17 @@ public class Rygel.MediaExportHarvester : GLib.Object {
this.containers.peek_head (),
file,
tag_list);
- item.parent_ref = this.containers.peek_head ();
- try {
- if (entry.update) {
- this.media_db.update_object (item);
- } else {
- this.media_db.save_object (item);
+ if (item != null) {
+ item.parent_ref = this.containers.peek_head ();
+ try {
+ if (entry.update) {
+ this.media_db.update_object (item);
+ } else {
+ this.media_db.save_object (item);
+ }
+ } catch (Error error) {
+ // Ignore it for now
}
- } catch (Error error) {
- // Ignore it for now
}
this.files.pop_head ();
diff --git a/src/plugins/media-export/rygel-media-export-item.vala b/src/plugins/media-export/rygel-media-export-item.vala
index 9b6f594..4a5c51e 100644
--- a/src/plugins/media-export/rygel-media-export-item.vala
+++ b/src/plugins/media-export/rygel-media-export-item.vala
@@ -137,8 +137,9 @@ public class Rygel.MediaExportItem : Rygel.MediaItem {
tag_list.get_int (MetadataExtractor.TAG_RYGEL_HEIGHT, out height)) {
class_guessed = MediaItem.IMAGE_CLASS;
} else {
- warning("There's no codec inside and no image for file" +
+ warning("There's no codec inside and file is no image: " +
"%s", file.get_uri ());
+ return null;
}
} else {
class_guessed = MediaItem.AUDIO_CLASS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]