Additional null checks.

This commit is contained in:
Knut Forkalsrud 2014-05-01 11:32:11 -07:00
parent b43caf0477
commit d006bc6707

View file

@ -391,11 +391,14 @@ public class AlbumServlet
if (n++ > 0) out.println(",");
out.println(" {");
out.println(" \"name\": " + jsStr(e.getName()) + ",");
out.println(" \"path\": " + jsStr(mapper.map(e.getThumbnail().getPath())) + ",");
out.println(" \"type\": " + jsStr(e.getType()) + ",");
out.println(" \"thumbtype\": " + jsStr(e.getThumbnail().getType()) + ",");
out.println(" \"width\": " + e.getThumbnail().getSize().getWidth() + ",");
out.println(" \"height\": " + e.getThumbnail().getSize().getHeight() + ",");
Thumbnail thumb = e.getThumbnail();
if (thumb != null) {
out.println(" \"path\": " + jsStr(mapper.map(thumb.getPath())) + ",");
out.println(" \"thumbtype\": " + jsStr(thumb.getType()) + ",");
out.println(" \"width\": " + thumb.getSize().getWidth() + ",");
out.println(" \"height\": " + thumb.getSize().getHeight() + ",");
}
out.println(" \"caption\": " + jsStr(e.getCaption()));
out.print(" }");
} catch (Exception ex) {