From: John F. Fay Date: Tue, 18 Sep 2007 02:32:53 +0000 (+0000) Subject: Addressing Feature Request #1307049 that "freeglut" should return 0 if "glutGetWindow... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=cce400b169362eaa5b50c4a255f5341bf00c8a20;p=freeglut 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: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@718 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/freeglut_window.c b/src/freeglut_window.c index 5ab924f..7236c91 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -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;