From 204eb255ab68974f4a45785ee13a32ad109856d2 Mon Sep 17 00:00:00 2001 From: danielpaulus Date: Sat, 23 Apr 2022 22:52:16 +0200 Subject: [PATCH] Fix/dtx panic (#130) forgot to handle an error that would crash with a panic instead of warning that the developer image was missing --- ios/dtx_codec/connection.go | 7 +++++-- ios/testmanagerd/xcuitestrunner_11.go | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) 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)