itest: fix nil error deref

Here we fix a nil pointer panic that is caused by an 'err' var being
deferenced before first checking that it is not nil. This was caused by
an oversite in a refactor commit that was attempting to improve line
length.
This commit is contained in:
Elle Mouton 2026-01-14 09:15:45 +02:00
parent b720db59c6
commit 3852d3169e
No known key found for this signature in database
GPG key ID: D7D916376026F177

View file

@ -1514,12 +1514,14 @@ func (hn *HarnessNode) Stop() error {
// Close any attempts at further grpc connections.
if hn.conn != nil {
err := hn.conn.Close()
isConnClosingErr := strings.Contains(
err.Error(), "connection is closing",
)
if err != nil && !isConnClosingErr {
return fmt.Errorf("error attempting to stop grpc "+
"client: %v", err)
if err != nil {
if !strings.Contains(
err.Error(), "connection is closing",
) {
return fmt.Errorf("error attempting to "+
"stop grpc client: %v", err)
}
}
}