Skip to content

Commit

Permalink
fix crash on invalid _type_error call
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Aug 9, 2020
1 parent 0272f67 commit ea6aea5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion func.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,10 @@ func funcBuiltins(interface{}) interface{} {
}

func internalfuncTypeError(v, x interface{}) interface{} {
return &funcTypeError{x.(string), v}
if x, ok := x.(string); ok {
return &funcTypeError{x, v}
}
return &funcTypeError{"_type_error", v}
}

func toInt(x interface{}) (int, bool) {
Expand Down

0 comments on commit ea6aea5

Please sign in to comment.