Set Sone of an album in the album builder, use album builder to add albums.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / SearchPage.java
index 4348434..db29fd2 100644 (file)
@@ -310,7 +310,7 @@ public class SearchPage extends SoneTemplatePage {
         */
        private String getSoneId(String phrase) {
                String soneId = phrase.startsWith("sone://") ? phrase.substring(7) : phrase;
-               return (webInterface.getCore().getSone(soneId) != null) ? soneId : null;
+               return (webInterface.getCore().getSone(soneId).isPresent()) ? soneId : null;
        }
 
        /**
@@ -354,7 +354,7 @@ public class SearchPage extends SoneTemplatePage {
         */
        private String getAlbumId(String phrase) {
                String albumId = phrase.startsWith("album://") ? phrase.substring(8) : phrase;
-               return (webInterface.getCore().getAlbum(albumId, false) != null) ? albumId : null;
+               return webInterface.getCore().getAlbum(albumId).isPresent() ? albumId : null;
        }
 
        /**
@@ -367,7 +367,7 @@ public class SearchPage extends SoneTemplatePage {
         */
        private String getImageId(String phrase) {
                String imageId = phrase.startsWith("image://") ? phrase.substring(8) : phrase;
-               return (webInterface.getCore().getImage(imageId, false) != null) ? imageId : null;
+               return webInterface.getCore().getImage(imageId).isPresent() ? imageId : null;
        }
 
        /**
@@ -581,7 +581,7 @@ public class SearchPage extends SoneTemplatePage {
 
                        @Override
                        public boolean apply(Hit<?> hit) {
-                               return hit.getScore() > 0;
+                               return (hit == null) ? false : hit.getScore() > 0;
                        }
 
                };