]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't try to pop from an empty stack in wxGDIPlusContext::PopState().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jul 2011 19:36:43 +0000 (19:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jul 2011 19:36:43 +0000 (19:36 +0000)
Using PopState() without a previous PushState() is an error but it shouldn't
result in a crash, so add an assert guarding against it.

Closes #13197.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/graphics.cpp

index 3c8e85fe8a99b3aaf7f4c1a6e6d1b428540d11e3..c1c7df147cc1adfd6bb584fa2b643db14a193975 100644 (file)
@@ -1547,6 +1547,8 @@ void wxGDIPlusContext::PushState()
 
 void wxGDIPlusContext::PopState()
 {
+    wxCHECK_RET( !m_stateStack.empty(), wxT("No state to pop") );
+
     GraphicsState state = m_stateStack.top();
     m_stateStack.pop();
     m_context->Restore(state);