Add a null pointer check when reading content type
authorChristos Stathis <chstath@ebs.gr>
Wed, 15 Feb 2012 15:31:22 +0000 (17:31 +0200)
committerChristos Stathis <chstath@ebs.gr>
Wed, 15 Feb 2012 15:31:22 +0000 (17:31 +0200)
src/gr/grnet/pithos/web/client/FileList.java

index 282f527..f9b4d21 100644 (file)
@@ -268,7 +268,7 @@ public class FileList extends Composite {
                        public SafeHtml getValue(File object) {
                                SafeHtmlBuilder sb = new SafeHtmlBuilder();
                 sb.append(Templates.INSTANCE.filenameSpan(object.getName()));
-                               if (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg")) {
+                               if (object.getContentType() != null && (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg"))) {
                                sb.appendHtmlConstant("&nbsp;")
                       .append(Templates.INSTANCE.viewLink(app.getApiPath() + object.getOwner() + object.getUri() + "?X-Auth-Token=" + app.getToken(), object.getName()));
                                }