Fix DisconnectPort() implementation 82/244382/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 18 Sep 2020 04:38:47 +0000 (13:38 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 18 Sep 2020 04:38:47 +0000 (13:38 +0900)
This patch adds an exception handling to check whether the main port is
nullptr or NOT. If the main port ptr is already deleted, the proxy process
will have crashed.

Change-Id: I0f6a97b2fcdbc715fae61feafe8db551d4f01cd6
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/proxy-internal.cc

index 90e54aac542702c823e746e1325ea366ed7d986c..3e0b7ede014c8e42573cc1f7aa5bcb5b8422814b 100644 (file)
@@ -247,8 +247,10 @@ int Proxy::ConnectSync(std::string appid, std::string port_name,
 }
 
 void Proxy::DisconnectPort() {
-  DebugPort::GetInst().RemoveSession(main_port_->GetFd());
-  main_port_.reset();
+  if (main_port_.get() != nullptr) {
+    DebugPort::GetInst().RemoveSession(main_port_->GetFd());
+    main_port_.reset();
+  }
 }
 
 void Proxy::SetRealAppId(const std::string& alias_appid) {