From 1a87c452b71e203d119c0577bd6cab4cb58a9a30 Mon Sep 17 00:00:00 2001 From: Johan Kotlinski Date: Sun, 14 Feb 2021 01:31:49 +0100 Subject: [PATCH] exit with error message instead of crash when a window cannot be opened --- SDL/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SDL/main.c b/SDL/main.c index 9025403..4f10ae9 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -677,6 +677,10 @@ int main(int argc, char **argv) window = SDL_CreateWindow("SameBoy v" xstr(VERSION), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 160 * configuration.default_scale, 144 * configuration.default_scale, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); + if (window == NULL) { + fputs(SDL_GetError(), stderr); + exit(1); + } SDL_SetWindowMinimumSize(window, 160, 144); if (fullscreen) {