From e7b943f5c4f68c08a64fcfe4260fa1936fa395e2 Mon Sep 17 00:00:00 2001
From: Alexander Mueller <alexander.mueller@hs.uni-hamburg.de>
Date: Wed, 21 Sep 2005 11:27:59 +0000
Subject: [PATCH] BugID: 392 Added pointer check and a isConnected check.

---
 MAC/GCF/TM/src/Port/GCF_Port.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAC/GCF/TM/src/Port/GCF_Port.cc b/MAC/GCF/TM/src/Port/GCF_Port.cc
index 9dd5d57e700..c0e1da20c0d 100644
--- a/MAC/GCF/TM/src/Port/GCF_Port.cc
+++ b/MAC/GCF/TM/src/Port/GCF_Port.cc
@@ -242,6 +242,15 @@ bool GCFPort::setRemoteAddr(const string& remotetask, const string& remoteport)
 
 ssize_t GCFPort::send(GCFEvent& e)
 {
+  if (!_pSlave || !isConnected()) 
+  {
+    LOG_ERROR(formatString (
+        "Port '%s' on task '%s' not connected! Event not sent!",
+        getName().c_str(),
+        getTask()->getName().c_str()));
+    return 0;
+  }
+
   if (SPP == _type)
   {
     if (!(F_EVT_INOUT(e) & F_OUT))
-- 
GitLab