From cce400b169362eaa5b50c4a255f5341bf00c8a20 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Tue, 18 Sep 2007 02:32:53 +0000 Subject: [PATCH] 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 --- src/freeglut_window.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- 1.7.10.4