diff --git a/src/org/kreed/vanilla/Song.java b/src/org/kreed/vanilla/Song.java index 061861a5..b03b1c52 100644 --- a/src/org/kreed/vanilla/Song.java +++ b/src/org/kreed/vanilla/Song.java @@ -171,6 +171,27 @@ public class Song implements Parcelable { albumId = cursor.getLong(5); } + /** + * Copies the fields from the given Song to this Song. + * + * @param other The Song to copy from. + */ + public void copy(Song other) + { + if (other == null) { + id = -1; + return; + } + + id = other.id; + albumId = other.albumId; + path = other.path; + title = other.title; + album = other.album; + artist = other.artist; + flags = other.flags; + } + /** * Query the MediaStore, if necessary, to fill this Song's fields. * diff --git a/src/org/kreed/vanilla/SongTimeline.java b/src/org/kreed/vanilla/SongTimeline.java index c41dba17..bec55781 100644 --- a/src/org/kreed/vanilla/SongTimeline.java +++ b/src/org/kreed/vanilla/SongTimeline.java @@ -329,7 +329,7 @@ public final class SongTimeline { } if (song == null || !song.query(false)) { - song = Song.randomSong(); + song.copy(Song.randomSong()); if (song == null || !song.query(false)) return null; }