Skip to content

Commit

Permalink
fix: fix potential nil dereference error
Browse files Browse the repository at this point in the history
Longhorn 9244

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Nov 29, 2024
1 parent 114edff commit 5cf64bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ func (c *SPDKClient) ReplicaRebuildingSrcStart(srcReplicaName, dstReplicaName, d
DstReplicaAddress: dstReplicaAddress,
ExposedSnapshotName: exposedSnapshotName,
})
return resp.ExposedSnapshotLvolAddress, errors.Wrapf(err, "failed to start replica rebuilding src %s for rebuilding replica %s(%s)", srcReplicaName, dstReplicaName, dstReplicaAddress)
if err != nil {
return "", errors.Wrapf(err, "failed to start replica rebuilding src %s for rebuilding replica %s(%s)", srcReplicaName, dstReplicaName, dstReplicaAddress)
}

Check warning on line 234 in pkg/client/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/client/client.go#L233-L234

Added lines #L233 - L234 were not covered by tests
return resp.ExposedSnapshotLvolAddress, nil
}

// ReplicaRebuildingSrcFinish asks the source replica to stop exposing the parent snapshot of the head (if necessary) and clean up the dst replica related cache
Expand Down

0 comments on commit 5cf64bb

Please sign in to comment.