Addressing Feature Request #1307049 that "freeglut" should return 0 if "glutGetWindow" is called without a prior call to "glutInit", rather than terminating on error.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@718 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2007-09-18 02:32:53 +00:00
parent f0f836b78d
commit 179cf69128

View File

@ -904,7 +904,14 @@ void FGAPIENTRY glutSetWindow( int ID )
int FGAPIENTRY glutGetWindow( void )
{
SFG_Window *win = fgStructure.CurrentWindow;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetWindow" );
/*
* Since GLUT did not throw an error if this function was called without a prior call to
* "glutInit", this function shouldn't do so here. Instead let us return a zero.
* See Feature Request "[ 1307049 ] glutInit check".
*/
if ( ! fgState.Initialised )
return 0;
while ( win && win->IsMenu )
win = win->Parent;
return win ? win->ID : 0;