Skip to content

Commit

Permalink
Fix: Check for a validly mapped OpenGL screen buffer during driver in…
Browse files Browse the repository at this point in the history
…it. (#9007)
  • Loading branch information
michicc committed Apr 11, 2021
1 parent d50b934 commit 5644c00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/sdl2_opengl_v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ const char *VideoDriver_SDL_OpenGL::Start(const StringList &param)
int w, h;
SDL_GetWindowSize(this->sdl_window, &w, &h);
this->ClientSizeChanged(w, h, true);
/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
if (_screen.dst_ptr == nullptr) {
this->Stop();
return "Can't get pointer to screen buffer";
}

return nullptr;
}
Expand Down
6 changes: 6 additions & 0 deletions src/video/win32_v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,12 @@ const char *VideoDriver_Win32OpenGL::Start(const StringList &param)
}

this->ClientSizeChanged(this->width, this->height, true);
/* We should have a valid screen buffer now. If not, something went wrong and we should abort. */
if (_screen.dst_ptr == nullptr) {
this->Stop();
_cur_resolution = old_res;
return "Can't get pointer to screen buffer";
}

MarkWholeScreenDirty();

Expand Down

0 comments on commit 5644c00

Please sign in to comment.