driver: Bug fix: (Key).String might cause infinite loop

This commit is contained in:
Hajime Hoshi 2020-04-22 00:32:35 +09:00
parent 2e49ed5402
commit 33e850a6d4
2 changed files with 2 additions and 2 deletions

View File

@ -437,7 +437,7 @@ func (k Key) String() string {
{{range $index, $name := .DriverKeyNames}}case Key{{$name}}:
return {{$name | printf "Key%s" | printf "%q"}}
{{end}}}
panic(fmt.Sprintf("driver: invalid key: %v", k))
panic(fmt.Sprintf("driver: invalid key: %d", k))
}
`

View File

@ -340,5 +340,5 @@ func (k Key) String() string {
case KeyUp:
return "KeyUp"
}
panic(fmt.Sprintf("driver: invalid key: %v", k))
panic(fmt.Sprintf("driver: invalid key: %d", k))
}