Skip to content

Commit

Permalink
fix(go): prevent double mutex unlock on t.Fatal
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Sep 19, 2024
1 parent 2754cfd commit 0ca61f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion west.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func WithInstance(i *Instance, f func()) {

func withCurrentInstance[T any](f func(*Instance) T, handleErr func(error)) T {
instanceMu.RLock()
defer instanceMu.RUnlock()
if instance == nil {
instanceMu.RUnlock()
func() {
Expand All @@ -115,6 +114,7 @@ func withCurrentInstance[T any](f func(*Instance) T, handleErr func(error)) T {
}()
instanceMu.RLock()
}
defer instanceMu.RUnlock()
return f(instance)
}

Expand Down

0 comments on commit 0ca61f0

Please sign in to comment.