Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Gabel2016-07-13 05:29:22 -0400
committerGerrit Code Review @ Eclipse.org2016-07-13 08:22:51 -0400
commita47bee0d51e731024be5f4385b5f32ac80ee6be9 (patch)
treed3aea2e2f723d26df5be227ec829a7b986376f86 /plugins
parent0f9caefb8b78f84844d4573e5a65b2211df12ca6 (diff)
downloadorg.eclipse.papyrus-a47bee0d51e731024be5f4385b5f32ac80ee6be9.tar.gz
org.eclipse.papyrus-a47bee0d51e731024be5f4385b5f32ac80ee6be9.tar.xz
org.eclipse.papyrus-a47bee0d51e731024be5f4385b5f32ac80ee6be9.zip
Bug 497816: Potential NPE in PartPasteStrategy#getSemanticCommand()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=497816 Check the returned value before instantiating a command wrapper and adding it to the final compound command. Change-Id: I8ea0e4123e3128abe1d95781ee16ca440a483659 Signed-off-by: Sebastien Gabel <sebastien.gabel@esterel-technologies.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
index 33f7ada612c..ec0a181ec6b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Sebastien Bordes (Esterel Technologies SAS) - Bug 497816
+ *
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.strategy.paste;
@@ -27,9 +29,9 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.wrappers.EMFtoGEFCommandWrapper;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.clipboard.IClipboardAdditionalData;
import org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.DefaultPasteStrategy;
import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
@@ -188,8 +190,10 @@ public class PartPasteStrategy implements IPasteStrategy {
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner);
if (provider != null) {
ICommand editCommand = provider.getEditCommand(moveRequest);
- GMFtoEMFCommandWrapper gmFtoEMFCommandWrapper = new GMFtoEMFCommandWrapper(editCommand);
- compoundCommand.append(gmFtoEMFCommandWrapper);
+ if (editCommand != null) {
+ GMFtoEMFCommandWrapper gmFtoEMFCommandWrapper = new GMFtoEMFCommandWrapper(editCommand);
+ compoundCommand.append(gmFtoEMFCommandWrapper);
+ }
}
}
}

Back to the top