From: David ‘Bombe’ Roden Date: Mon, 20 Jul 2015 17:08:04 +0000 (+0200) Subject: Return original image when they can’t be moved X-Git-Tag: 0.9.3^2~15^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=851d4fd51d44b92452aef92450022999a97a0483;p=Sone.git Return original image when they can’t be moved --- diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java index c569e0a..fa1538d 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java @@ -209,7 +209,7 @@ public class AlbumImpl implements Album { checkArgument(image.getAlbum().equals(this), "image must belong to this album"); int oldIndex = imageIds.indexOf(image.getId()); if (oldIndex <= 0) { - return null; + return image; } imageIds.remove(image.getId()); imageIds.add(oldIndex - 1, image.getId()); @@ -224,7 +224,7 @@ public class AlbumImpl implements Album { checkArgument(image.getAlbum().equals(this), "image must belong to this album"); int oldIndex = imageIds.indexOf(image.getId()); if ((oldIndex == -1) || (oldIndex >= (imageIds.size() - 1))) { - return null; + return image; } imageIds.remove(image.getId()); imageIds.add(oldIndex + 1, image.getId());