From 76738ae8b779c49ba5c06e984e3d167e6913225e Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 13 Sep 2009 15:47:25 +0000 Subject: [PATCH] Be more paranoid about parent window possibly being NULL (partly fixes #11195). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@61904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/spinbutt.cpp | 7 +++++-- src/os2/spinctrl.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index c176baa141..4f6c7dc48e 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -63,8 +63,11 @@ bool wxSpinButton::Create( m_windowId = NewControlId(); else m_windowId = vId; - m_backgroundColour = pParent->GetBackgroundColour(); - m_foregroundColour = pParent->GetForegroundColour(); + if (pParent) + { + m_backgroundColour = pParent->GetBackgroundColour(); + m_foregroundColour = pParent->GetForegroundColour(); + } SetName(rsName); SetParent(pParent); m_windowStyle = lStyle; diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index 6fb50893aa..656e6ce899 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -126,8 +126,11 @@ bool wxSpinCtrl::Create( wxWindow* pParent, m_windowId = NewControlId(); else m_windowId = vId; - m_backgroundColour = pParent->GetBackgroundColour(); - m_foregroundColour = pParent->GetForegroundColour(); + if (pParent) + { + m_backgroundColour = pParent->GetBackgroundColour(); + m_foregroundColour = pParent->GetForegroundColour(); + } SetName(rsName); SetParent(pParent); m_windowStyle = lStyle;