Merge pull request #345 from jkotlinski/fail-nicely-on-missing-window

exit with error message instead of crash when a window cannot be opened
This commit is contained in:
Lior Halphon 2021-02-14 02:33:58 +02:00 committed by GitHub
commit 759ff1927e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -677,6 +677,10 @@ int main(int argc, char **argv)
window = SDL_CreateWindow("SameBoy v" xstr(VERSION), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 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); 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); SDL_SetWindowMinimumSize(window, 160, 144);
if (fullscreen) { if (fullscreen) {