uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 2afded6e05b585dea7802d2cc1bd7487b46c51a2
parent 297046ec145263a9620652c80da23f5f97f19669
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date:   Sun, 24 Oct 2021 21:48:56 +0200

check SDL_UpdateTexture return code as well

Diffstat:
Msrc/uxnemu.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -156,8 +156,9 @@ set_size(Uint16 width, Uint16 height, int is_resize) SDL_RenderSetLogicalSize(gRenderer, ppu.width + PAD * 2, ppu.height + PAD * 2); gTexture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ppu.width + PAD * 2, ppu.height + PAD * 2); if(gTexture == NULL || SDL_SetTextureBlendMode(gTexture, SDL_BLENDMODE_NONE)) - return error("sdl_texture", SDL_GetError()); - SDL_UpdateTexture(gTexture, NULL, ppu_screen, sizeof(Uint32)); + return error("gTexture", SDL_GetError()); + if(SDL_UpdateTexture(gTexture, NULL, ppu_screen, sizeof(Uint32)) != 0) + return error("SDL_UpdateTexture", SDL_GetError()); if(is_resize) set_window_size(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom); ppu.reqdraw = 1; @@ -219,7 +220,8 @@ redraw(Uxn *u) for(y = 0; y < ppu.height; ++y) for(x = 0; x < ppu.width; ++x) ppu_screen[x + y * ppu.width] = palette[ppu_read(&ppu, x, y)]; - SDL_UpdateTexture(gTexture, &gRect, ppu_screen, ppu.width * sizeof(Uint32)); + if(SDL_UpdateTexture(gTexture, &gRect, ppu_screen, ppu.width * sizeof(Uint32)) != 0) + error("SDL_UpdateTexture", SDL_GetError()); SDL_RenderClear(gRenderer); SDL_RenderCopy(gRenderer, gTexture, NULL, NULL); SDL_RenderPresent(gRenderer);