From 30dd5dd8fda4e33fb577173155ce712c3f7110f6 Mon Sep 17 00:00:00 2001
From: Peter Soetens <peter@thesourceworks.com>
Date: Wed, 5 Oct 2011 11:13:19 +0200
Subject: [PATCH 1/2] rtt_dot_service: support plotting of free ports.

A free port is not bound to a DataFlowInterface. This happens
sometimes in Lua scripts.

Signed-off-by: Ruben Smits <ruben.smits@mech.kuleuven.be>
---
 src/rtt_dot_service.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/rtt_dot_service.cpp b/src/rtt_dot_service.cpp
index 0a18f05..c9341f2 100644
--- a/src/rtt_dot_service.cpp
+++ b/src/rtt_dot_service.cpp
@@ -106,14 +106,20 @@ bool Dot::execute(){
         log(Debug) << "Connection id: " << cp.name_id << endlog();
         std::string comp_in, port_in;
         if(bs->getInputEndPoint()->getPort()!=0){
-          comp_in = bs->getInputEndPoint()->getPort()->getInterface()->getOwner()->getName();
+          if (bs->getInputEndPoint()->getPort()->getInterface() != 0 )
+            comp_in = bs->getInputEndPoint()->getPort()->getInterface()->getOwner()->getName();
+          else
+            comp_in = "free input ports";
           port_in = bs->getInputEndPoint()->getPort()->getName();
         }
         log(Debug) << "Connection starts at port: " << port_in << endlog();
         log(Debug) << "Connection starts at component: " << comp_in << endlog();
         std::string comp_out, port_out;
         if(bs->getOutputEndPoint()->getPort()!=0){
-          comp_out = bs->getOutputEndPoint()->getPort()->getInterface()->getOwner()->getName();
+          if (bs->getOutputEndPoint()->getPort()->getInterface() != 0 )
+            comp_out = bs->getOutputEndPoint()->getPort()->getInterface()->getOwner()->getName();
+          else
+            comp_in = "free output ports";
           port_out = bs->getOutputEndPoint()->getPort()->getName();
         }
         log(Debug) << "Connection ends at port: " << port_out << endlog();
-- 
1.7.4.1

