Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlois Zoitl2018-04-30 20:55:00 +0000
committerAlois Zoitl2018-04-30 20:55:00 +0000
commit910bb32187dcddf53f11fe7431370b4c47b558be (patch)
tree80afd995b1dcb36e483e7436518a87db8ecba2ed
parentec03a84908db9ce86658fee2299e0a975cedd249 (diff)
downloadorg.eclipse.4diac.ide-910bb32187dcddf53f11fe7431370b4c47b558be.tar.gz
org.eclipse.4diac.ide-910bb32187dcddf53f11fe7431370b4c47b558be.tar.xz
org.eclipse.4diac.ide-910bb32187dcddf53f11fe7431370b4c47b558be.zip
[534207] Added null check for not found connection on con delete
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534207 Signed-off-by: Alois Zoitl <alois.zoitl@gmx.at>
-rw-r--r--plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java
index 0e062171e..3827ed561 100644
--- a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java
+++ b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java
@@ -93,16 +93,18 @@ public class DeleteConnectionCommand extends Command {
FBNetworkElement opSource = source.getFBNetworkElement().getOpposite();
FBNetworkElement opDestination = destination.getFBNetworkElement().getOpposite();
if(null != opSource && null != opDestination && opSource.getFbNetwork() == opDestination.getFbNetwork()){
- Connection con = findConnection(opSource.getInterfaceElement(source.getName()), opDestination.getInterfaceElement(destination.getName()));
- DeleteConnectionCommand cmd = new DeleteConnectionCommand(con);
- cmd.setPerformMappingCheck(false); //as this is the command for the mirrored connection we don't want again to check
- return (cmd.canExecute()) ? cmd : null;
+ Connection con = findConnection(opSource.getInterfaceElement(source.getName()), opDestination.getInterfaceElement(destination.getName()));
+ if(null != con) {
+ DeleteConnectionCommand cmd = new DeleteConnectionCommand(con);
+ cmd.setPerformMappingCheck(false); //as this is the command for the mirrored connection we don't want again to check
+ return (cmd.canExecute()) ? cmd : null;
+ }
}
}
return null;
}
- private Connection findConnection(IInterfaceElement source, IInterfaceElement destination) {
+ private static Connection findConnection(IInterfaceElement source, IInterfaceElement destination) {
for (Connection con : source.getOutputConnections()) {
if(con.getDestination() == destination){
return con;

Back to the top