diff options
author | Lakshmi Shanmugam | 2020-06-16 09:39:05 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2020-06-17 05:03:34 +0000 |
commit | 2d240605f5653a84bb14e03e4ba6e5307e1e9869 (patch) | |
tree | 4d358cb428687a5cd72a5992678acb1f26050d2b /bundles | |
parent | 98a047ed19e2f8f6ee25c7563c913c6258fa6324 (diff) | |
download | eclipse.platform.swt-2d240605f5653a84bb14e03e4ba6e5307e1e9869.tar.gz eclipse.platform.swt-2d240605f5653a84bb14e03e4ba6e5307e1e9869.tar.xz eclipse.platform.swt-2d240605f5653a84bb14e03e4ba6e5307e1e9869.zip |
Bug 563796 - NPE in DropTarget.getOperationFromKeyState
Added null check for NSApplication.currentEvent().
Change-Id: Ic1715e6931c7a675a425d6a38f89f6bba4ae68f5
Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java index 979e1e4f33..988f18dd44 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java @@ -546,12 +546,14 @@ int getOperationFromKeyState() { // correct Cocoa behavior. Control + Option or Command is NSDragOperationGeneric, // or DND.DROP_DEFAULT in the SWT. NSEvent currEvent = NSApplication.sharedApplication().currentEvent(); - long modifiers = currEvent.modifierFlags(); - boolean option = (modifiers & OS.NSAlternateKeyMask) == OS.NSAlternateKeyMask; - boolean control = (modifiers & OS.NSControlKeyMask) == OS.NSControlKeyMask; - if (control && option) return DND.DROP_DEFAULT; - if (control) return DND.DROP_LINK; - if (option) return DND.DROP_COPY; + if (currEvent != null) { + long modifiers = currEvent.modifierFlags(); + boolean option = (modifiers & OS.NSAlternateKeyMask) == OS.NSAlternateKeyMask; + boolean control = (modifiers & OS.NSControlKeyMask) == OS.NSControlKeyMask; + if (control && option) return DND.DROP_DEFAULT; + if (control) return DND.DROP_LINK; + if (option) return DND.DROP_COPY; + } return DND.DROP_DEFAULT; } |