aboutsummaryrefslogtreecommitdiff
path: root/sdl2/image/image.ha
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2025-10-20 19:44:46 +0200
committerDrew DeVault <drew@ddevault.org>2025-10-21 09:35:37 +0200
commitfb6008be0b79a2a24b1ac960316a83f7873b4f39 (patch)
treeecc633c0dbfbc72422fbec5f66af639a7ee2b8be /sdl2/image/image.ha
parentsdl2/rwops: assert on allocation failure (diff)
downloadhare-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/image/image.ha4
1 files changed, 2 insertions, 2 deletions
diff --git a/sdl2/image/image.ha b/sdl2/image/image.ha
index 32f8f3d..b4af99e 100644
--- a/sdl2/image/image.ha
+++ b/sdl2/image/image.ha
@@ -27,7 +27,7 @@ export @symbol("IMG_Quit") fn IMG_Quit() void;
// Load an image from a file path.
export fn IMG_Load(file: str) (*sdl2::SDL_Surface | sdl2::error) = {
- const file = c::fromstr(file);
+ const file = c::fromstr(file)!;
defer free(file);
return sdl2::wrapptr(_IMG_Load(file))?: *sdl2::SDL_Surface;
};
@@ -40,7 +40,7 @@ export fn IMG_LoadTexture(
SDL_Renderer: *sdl2::SDL_Renderer,
file: str,
) (*sdl2::SDL_Texture | sdl2::error) = {
- const file = c::fromstr(file);
+ const file = c::fromstr(file)!;
defer free(file);
return sdl2::wrapptr(_IMG_LoadTexture(SDL_Renderer, file))?: *sdl2::SDL_Texture;
};