that was too quick, fgStructure.CurrentWindow can be NULL when glutGetting window
authorDiederick Niehorster <dcnieho@gmail.com>
Fri, 23 Nov 2012 09:42:54 +0000 (09:42 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Fri, 23 Nov 2012 09:42:54 +0000 (09:42 +0000)
width or height

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1485 7f0cb862-5218-0410-a997-914c9d46530a

src/mswin/fg_state_mswin.c

index 5dc859c..c293ebf 100644 (file)
@@ -177,7 +177,6 @@ int fgPlatformGlutGet ( GLenum eWhat )
         RECT winRect;
         POINT topLeft = {0,0};
 
-        freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
 
 #if defined(_WIN32_WCE)
         GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect);
@@ -203,8 +202,10 @@ int fgPlatformGlutGet ( GLenum eWhat )
     break;
 
     case GLUT_WINDOW_WIDTH:
+        freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
         return fgStructure.CurrentWindow->State.Width;
     case GLUT_WINDOW_HEIGHT:
+        freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 );
         return fgStructure.CurrentWindow->State.Height;
 
     case GLUT_WINDOW_BORDER_WIDTH :