From d72938678776ee2f4771b6c97f4921a1ef89dae8 Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 4 Jan 2015 09:12:30 +0100 Subject: [PATCH] fix NPE in viewimage Caused by: java.lang.NullPointerException at net.yacy.peers.graphics.EncodedImage.(EncodedImage.java:73) at ViewImage.respond(ViewImage.java:156) --- htroot/ViewImage.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java index eed6dfc33..d07cfae3c 100644 --- a/htroot/ViewImage.java +++ b/htroot/ViewImage.java @@ -152,9 +152,11 @@ public class ViewImage { // read image image = ImageParser.parse(urlString, imgb); - - if (image == null || (auth && (width == 0 || height == 0) && maxwidth == 0 && maxheight == 0)) return ext == null ? image : new EncodedImage(image, ext, isStatic); - + if (image == null) { + return null; + } else { + if ((auth && (width == 0 || height == 0) && maxwidth == 0 && maxheight == 0)) return ext == null ? image : new EncodedImage(image, ext, isStatic); + } // find original size final int h = image.getHeight(null); final int w = image.getWidth(null);