diff --git a/ios/dtx_codec/connection.go b/ios/dtx_codec/connection.go index 0e2c2547..dec0fd63 100644 --- a/ios/dtx_codec/connection.go +++ b/ios/dtx_codec/connection.go @@ -40,8 +40,11 @@ type GlobalDispatcher struct { const requestChannel = "_requestChannelWithCode:identifier:" //Close closes the underlying deviceConnection -func (dtxConn *Connection) Close() { - dtxConn.deviceConnection.Close() +func (dtxConn *Connection) Close() error { + if dtxConn.deviceConnection != nil { + return dtxConn.deviceConnection.Close() + } + return nil } //GlobalChannel returns the connections automatically created global channel. diff --git a/ios/testmanagerd/xcuitestrunner_11.go b/ios/testmanagerd/xcuitestrunner_11.go index 8b48b47e..23a7ffa0 100644 --- a/ios/testmanagerd/xcuitestrunner_11.go +++ b/ios/testmanagerd/xcuitestrunner_11.go @@ -22,6 +22,9 @@ func RunXCUIWithBundleIds11( } log.Debugf("test session setup ok") conn, err := dtx.NewConnection(device, testmanagerd) + if err != nil { + return err + } defer conn.Close() ideDaemonProxy := newDtxProxyWithConfig(conn, testConfig)