summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Munteanu2011-09-30 10:31:24 (EDT)
committerSteffen Pingel2011-09-30 10:31:24 (EDT)
commit954845ff13419f7a59ac8cb77d71402565d4075a (patch)
treebf07c39a5f79a014afd58e2325888d4afb5f34e7
parent5392bbe6c0f3c613a69b84d95182c753c780ca61 (diff)
downloadorg.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.zip
org.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.tar.gz
org.eclipse.mylyn.tasks-954845ff13419f7a59ac8cb77d71402565d4075a.tar.bz2
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 f2db46e..35c9be8 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));