Return original album when it can’t be moved
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 20 Jul 2015 17:10:31 +0000 (19:10 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 20 Jul 2015 17:10:31 +0000 (19:10 +0200)
src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java

index fa1538d..3488577 100644 (file)
@@ -134,7 +134,7 @@ public class AlbumImpl implements Album {
                checkArgument(equals(album.getParent()), "album must belong to this album");
                int oldIndex = albums.indexOf(album);
                if (oldIndex <= 0) {
-                       return null;
+                       return album;
                }
                albums.remove(oldIndex);
                albums.add(oldIndex - 1, album);
@@ -148,7 +148,7 @@ public class AlbumImpl implements Album {
                checkArgument(equals(album.getParent()), "album must belong to this album");
                int oldIndex = albums.indexOf(album);
                if ((oldIndex < 0) || (oldIndex >= (albums.size() - 1))) {
-                       return null;
+                       return album;
                }
                albums.remove(oldIndex);
                albums.add(oldIndex + 1, album);