소스 검색

Fixed crash if display couldn't be found in SDL_UpdateFullscreenMode()

Sam Lantinga 2 년 전
부모
커밋
4c0758a234
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/video/SDL_video.c

+ 4 - 0
src/video/SDL_video.c

@@ -1462,6 +1462,10 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
     /* Get the correct display for this operation */
     /* Get the correct display for this operation */
     if (fullscreen) {
     if (fullscreen) {
         display = SDL_GetVideoDisplayForWindow(window);
         display = SDL_GetVideoDisplayForWindow(window);
+        if (!display) {
+            /* This should never happen, but it did... */
+            goto done;
+        }
     } else {
     } else {
         for (i = 0; i < _this->num_displays; ++i) {
         for (i = 0; i < _this->num_displays; ++i) {
             display = &_this->displays[i];
             display = &_this->displays[i];