diff options
| author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2025-10-20 19:44:46 +0200 |
|---|---|---|
| committer | Drew DeVault <drew@ddevault.org> | 2025-10-21 09:35:37 +0200 |
| commit | fb6008be0b79a2a24b1ac960316a83f7873b4f39 (patch) | |
| tree | ecc633c0dbfbc72422fbec5f66af639a7ee2b8be /sdl2/keyboard.ha | |
| parent | sdl2/rwops: assert on allocation failure (diff) | |
| download | hare-chip8-fb6008be0b79a2a24b1ac960316a83f7873b4f39.tar.gz | |
Add ! after c::fromstr calls to handle nomem
Lazy way out, might be better to change API either by returning
nomem or using `*char` as parameter so it's caller controlled
instead of `str`.
Diffstat (limited to '')
| -rw-r--r-- | sdl2/keyboard.ha | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sdl2/keyboard.ha b/sdl2/keyboard.ha index b9759dd..02cedae 100644 --- a/sdl2/keyboard.ha +++ b/sdl2/keyboard.ha @@ -635,7 +635,7 @@ export type SDL_Keysym = struct { @symbol("SDL_GetKeyFromName") fn _SDL_GetKeyFromName(name: *const c::char) SDL_Keycode; export fn SDL_GetKeyFromName(name: str) (SDL_Keycode | error) = { - const name = c::fromstr(name); + const name = c::fromstr(name)!; defer free(name); const sym = _SDL_GetKeyFromName(name); if (sym == SDL_Keycode::UNKNOWN) { |
