Skip to content

Commit cad1b8d

Browse files
committed
check type assertion
1 parent fa5e94f commit cad1b8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Context.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ func GenAutoID(id string) ID {
1717
idxAny, ok := Context.widgetIndex.Load(id)
1818

1919
if ok {
20-
idx = idxAny.(int)
20+
idx, ok = idxAny.(int)
21+
Assert(ok, "Context", "GenAutoID", "unexpected type of widgetIndex value: expected int, instead found %T", idxAny)
22+
2123
idx++
2224
}
2325

0 commit comments

Comments
 (0)