session: fix a crash when using unregistered transport proto

Type: improvement

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I39e3e007da2b99321bebf3e1c1ebb1d87547f532
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 54ce917..192a201 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -314,6 +314,8 @@
 int
 transport_connect (transport_proto_t tp, transport_endpoint_cfg_t * tep)
 {
+  if (PREDICT_FALSE (!tp_vfts[tp].connect))
+    return SESSION_E_TRANSPORT_NO_REG;
   return tp_vfts[tp].connect (tep);
 }
 
@@ -343,6 +345,8 @@
 transport_start_listen (transport_proto_t tp, u32 session_index,
 			transport_endpoint_cfg_t *tep)
 {
+  if (PREDICT_FALSE (!tp_vfts[tp].start_listen))
+    return SESSION_E_TRANSPORT_NO_REG;
   return tp_vfts[tp].start_listen (session_index, tep);
 }