Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Munteanu2011-09-30 14:31:24 +0000
committerSteffen Pingel2011-09-30 14:31:24 +0000
commit954845ff13419f7a59ac8cb77d71402565d4075a (patch)
treebf07c39a5f79a014afd58e2325888d4afb5f34e7
parent5392bbe6c0f3c613a69b84d95182c753c780ca61 (diff)
downloadorg.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.tar.gz
org.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.tar.xz
org.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.zip
TaskAttachmentDropListener: guard against a null payload
When dropping a supported event type with a null payload a NPE is thrown. This can happen, for instance, when dropping an 'Install' badge from an Eclipse marketplace entry. Signed-off-by: Robert Munteanu <robert.munteanu@gmail.com> Bug: 359539
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java
index f2db46ee2..35c9be88a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java
@@ -8,6 +8,7 @@
* Contributors:
* Tasktop Technologies - initial API and implementation
* Maarten Meijer - improvements
+ * Robert Munteanu - fix for bug 359539
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.ui.editors;
@@ -91,7 +92,7 @@ public class TaskAttachmentDropListener implements DropTargetListener {
}
if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
String[] files = (String[]) event.data;
- if (files.length > 0) {
+ if (files != null && files.length > 0) {
File file = new File(files[0]);
NewAttachmentWizardDialog dialog = EditorUtil.openNewAttachmentWizard(page, null,
new FileTaskAttachmentSource(file));

Back to the top