Skip to content

Commit

Permalink
check type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Nov 27, 2024
1 parent fa5e94f commit cad1b8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ func GenAutoID(id string) ID {
idxAny, ok := Context.widgetIndex.Load(id)

if ok {
idx = idxAny.(int)
idx, ok = idxAny.(int)
Assert(ok, "Context", "GenAutoID", "unexpected type of widgetIndex value: expected int, instead found %T", idxAny)

idx++
}

Expand Down

0 comments on commit cad1b8d

Please sign in to comment.