Remove the possibility to create images for unknown IDs.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / SearchPage.java
index 6c9e15c..ceb192e 100644 (file)
@@ -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;
                        }
 
                };