]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed drag and drop failure when message dragged from email client (#20451)
authoradam <adam@vaadin.com>
Sat, 12 Nov 2016 13:25:52 +0000 (15:25 +0200)
committerVaadin Code Review <review@vaadin.com>
Wed, 16 Nov 2016 07:40:42 +0000 (07:40 +0000)
When dragging message form email client on Windows, item.webkitGetAsEntry()
might return null creating NPE on the client side. Added additional checks
for this situation.

Change-Id: I569f7e6d0d7b137f24be53d1fbce384695ae8c73

client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java

index 785d24af74e1cb087671ec9eb362a2f3f3262c69..7eb1af431578ff0eee928da874e9bba17bc5bda7 100644 (file)
@@ -90,8 +90,11 @@ public class VHtml5DragEvent extends NativeEvent {
         // Chrome >= v21 and Opera >= v?
         if (this.dataTransfer.items) {
             var item = this.dataTransfer.items[fileIndex];
-            if (item.webkitGetAsEntry) {
-                return item.webkitGetAsEntry().isFile;
+            if (typeof item.webkitGetAsEntry == "function") {
+                var entry = item.webkitGetAsEntry();
+                if (typeof entry !== "undefined" && entry !== null) {
+                    return entry.isFile;
+                }
             }
         }