From 8675f35fc82d45163d4afcd0879edb20ea7c8aba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 15 Aug 2014 12:14:06 +0000 Subject: [PATCH] Fix creating wxGLCanvas without any attributes in wxMSW This was broken by the changes of f0e67ed517df42161155a22a98c119298be96457, see #16402. Just check that we do have the attributes before examining them. (cherry picked from commit 74421a7f35240420e3ffaaa4cf40acc30a4c7a89) --- src/msw/glcanvas.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index e130a970a4..58a3658c7c 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -321,25 +321,28 @@ bool wxGLCanvas::Create(wxWindow *parent, glVersionMinor = 0; // Check for a core profile request - for ( int i = 0; attribList[i]; ) + if ( attribList ) { - switch ( attribList[i++] ) + for ( int i = 0; attribList[i]; ) { - case WX_GL_CORE_PROFILE: - useGLCoreProfile = true; - break; + switch ( attribList[i++] ) + { + case WX_GL_CORE_PROFILE: + useGLCoreProfile = true; + break; - case WX_GL_MAJOR_VERSION: - glVersionMajor = attribList[i++]; - break; + case WX_GL_MAJOR_VERSION: + glVersionMajor = attribList[i++]; + break; - case WX_GL_MINOR_VERSION: - glVersionMinor = attribList[i++]; - break; + case WX_GL_MINOR_VERSION: + glVersionMinor = attribList[i++]; + break; - default: - // ignore all other flags for now - break; + default: + // ignore all other flags for now + break; + } } }