[rygel] core: Don't compare apples and oranges
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Don't compare apples and oranges
- Date: Wed, 25 Aug 2010 14:45:40 +0000 (UTC)
commit 5d387d745677cedb49428031af9839303863c4c4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Aug 25 16:03:37 2010 +0300
core: Don't compare apples and oranges
Before comparing two items, first make sure they are of the same type.
src/rygel/rygel-media-item.vala | 4 ++++
src/rygel/rygel-music-item.vala | 4 ++++
src/rygel/rygel-photo-item.vala | 4 ++++
src/rygel/rygel-video-item.vala | 4 ++++
4 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 7b7cef2..35e5858 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -127,6 +127,10 @@ public abstract class Rygel.MediaItem : MediaObject {
internal override int compare_by_property (MediaObject media_object,
string property) {
+ if (!(media_object is MediaItem)) {
+ return 1;
+ }
+
var item = media_object as MediaItem;
switch (property) {
diff --git a/src/rygel/rygel-music-item.vala b/src/rygel/rygel-music-item.vala
index 3885c13..8e4e6e4 100644
--- a/src/rygel/rygel-music-item.vala
+++ b/src/rygel/rygel-music-item.vala
@@ -74,6 +74,10 @@ public class Rygel.MusicItem : AudioItem {
internal override int compare_by_property (MediaObject media_object,
string property) {
+ if (!(media_object is MusicItem)) {
+ return 1;
+ }
+
var item = media_object as MusicItem;
switch (property) {
diff --git a/src/rygel/rygel-photo-item.vala b/src/rygel/rygel-photo-item.vala
index df46cb1..83b1a7b 100644
--- a/src/rygel/rygel-photo-item.vala
+++ b/src/rygel/rygel-photo-item.vala
@@ -43,6 +43,10 @@ public class Rygel.PhotoItem : ImageItem {
internal override int compare_by_property (MediaObject media_object,
string property) {
+ if (!(media_object is PhotoItem)) {
+ return 1;
+ }
+
var item = media_object as PhotoItem;
switch (property) {
diff --git a/src/rygel/rygel-video-item.vala b/src/rygel/rygel-video-item.vala
index 4a2ef74..59435cb 100644
--- a/src/rygel/rygel-video-item.vala
+++ b/src/rygel/rygel-video-item.vala
@@ -103,6 +103,10 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
internal override int compare_by_property (MediaObject media_object,
string property) {
+ if (!(media_object is VideoItem)) {
+ return 1;
+ }
+
var item = media_object as VideoItem;
switch (property) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]