From b73f2bdb76c61e6062f85c7e93caca9746b5af4f Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 12 Nov 2016 15:25:52 +0200 Subject: [PATCH] Fixed drag and drop failure when message dragged from email client (#20451) 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 --- .../main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java index 581d9263ac..830f668a00 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java @@ -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; + } } } -- 2.39.5