SDL-1.2: os2fslib_SetVideoMode: return NULL immediately if OpenGL flag is present

From 6033b9c864aaa43d22fe29a4c24e98b6d5cbd4ca Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 3 Mar 2021 11:56:10 +0300
Subject: [PATCH] os2fslib_SetVideoMode: return NULL immediately if OpenGL flag
 is present

---
 src/video/os2fslib/SDL_os2fslib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/video/os2fslib/SDL_os2fslib.c b/src/video/os2fslib/SDL_os2fslib.c
index ebb62df6..b612a2e6 100644
--- a/src/video/os2fslib/SDL_os2fslib.c
+++ b/src/video/os2fslib/SDL_os2fslib.c
@@ -1637,7 +1637,7 @@ int os2fslib_IconifyWindow(_THIS)
   ERRORID hmqerror;
 
   /* If there is no more window, nothing we can do */
-  if (_this->hidden->iPMThreadStatus!=1) return 0;
+  if (_this->hidden->iPMThreadStatus != 1) return 0;
 
   /* Cannot do anything in fullscreen mode */
   if (FSLib_QueryFSMode(_this->hidden->hwndClient))
@@ -1934,8 +1934,13 @@ static SDL_Surface *os2fslib_SetVideoMode(_THIS, SDL_Surface *current,
   RECTL rectl;
   SDL_Surface *pResult;
 
+  if (flags & SDL_OPENGL) {
+    SDL_SetError("OS2 driver not configured with OpenGL");
+    return NULL;
+  }
+
   /* If there is no more window, nothing we can do */
-  if (_this->hidden->iPMThreadStatus!=1) return NULL;
+  if (_this->hidden->iPMThreadStatus != 1) return NULL;
 
   dbgprintf("[os2fslib_SetVideoMode] : Request for %dx%d @ %dBPP, flags=0x%x\n", width, height, bpp, flags);