check if main window exists before calling getWindowIndex( 0 ).  Fixes #569.
Merge pull request #589 from richardeakin/glNext_no_window_update_fix

Check if main window exists before calling getWindowIndex( 0 ).