diff --git a/src/devices/screen.c b/src/devices/screen.c index 899163d..8574121 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -86,15 +86,15 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height) bg = realloc(p->bg.pixels, width * height), fg = realloc(p->fg.pixels, width * height); pixels = realloc(p->pixels, width * height * sizeof(Uint32)); - if(bg) p->bg.pixels = bg; - if(fg) p->fg.pixels = fg; - if(pixels) p->pixels = pixels; - if(bg && fg && pixels) { - p->width = width; - p->height = height; - screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0); - screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0); - } + if(!bg || !fg || !pixels) + return; + p->bg.pixels = bg; + p->fg.pixels = fg; + p->pixels = pixels; + p->width = width; + p->height = height; + screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0); + screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0); } void diff --git a/src/uxnemu.c b/src/uxnemu.c index a654629..cb3e206 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -399,9 +399,8 @@ handle_events(Uxn *u) SDL_free(event.drop.file); } /* Audio */ - else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { + else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) uxn_eval(u, PEEK2(&u->dev[0x30 + 0x10 * (event.type - audio0_event)])); - } /* Mouse */ else if(event.type == SDL_MOUSEMOTION) mouse_pos(u, &u->dev[0x90], clamp(event.motion.x - PAD, 0, uxn_screen.width - 1), clamp(event.motion.y - PAD, 0, uxn_screen.height - 1));