Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
a-palchikov committed Oct 3, 2022
1 parent 3c12443 commit 188c5ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions solver/result/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ func (r *Result[T]) EachRef(fn func(T) error) (err error) {
// a and b are assumed to be of the same size and map their references
// to the same set of keys
func EachRef[U any, V any](a *Result[U], b *Result[V], fn func(U, V) error) (err error) {
if reflect.ValueOf(a.Ref).IsValid() {
if reflect.ValueOf(a.Ref).IsValid() && reflect.ValueOf(b.Ref).IsValid() {
err = fn(a.Ref, b.Ref)
}
for k, r := range a.Refs {
if reflect.ValueOf(r).IsValid() {
if reflect.ValueOf(r).IsValid() && reflect.ValueOf(b.Refs[k]).IsValid() {
if err1 := fn(r, b.Refs[k]); err1 != nil && err == nil {
err = err1
}
Expand Down

0 comments on commit 188c5ad

Please sign in to comment.