summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-27 10:24:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-27 12:57:49 +0000
commit583c0ee3e114a91548a229ef6a50932577f40133 (patch)
tree8b685fcf773c498c2494602f7333826d991fb4a6 /vcl/source/control
parent43d42775cb9e1d1c4a9abb415321963916b76db3 (diff)
coverity#1187660 Dereference after null check
Change-Id: I41a05e34c9b1dd312602f2c499793a4568473394
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/button.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index fa061d73af39..e45874dfc046 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -605,9 +605,17 @@ void PushButton::ImplInitPushButtonData()
mbInUserDraw = false;
}
+<<<namespace
+{
+ Window* getPreviousSibling(Window *pParent)
+ {
+ return pParent ? pParent->GetWindow(WINDOW_LASTCHILD) : NULL;
+ }
+}
+
void PushButton::ImplInit( Window* pParent, WinBits nStyle )
{
- nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ nStyle = ImplInitStyle(getPreviousSibling(pParent), nStyle);
Button::ImplInit( pParent, nStyle, NULL );
if ( nStyle & WB_NOLIGHTBORDER )
@@ -1808,7 +1816,7 @@ void RadioButton::ImplInitRadioButtonData()
void RadioButton::ImplInit( Window* pParent, WinBits nStyle )
{
- nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ nStyle = ImplInitStyle(getPreviousSibling(pParent), nStyle);
Button::ImplInit( pParent, nStyle, NULL );
ImplInitSettings( true, true, true );
@@ -2930,7 +2938,7 @@ void CheckBox::ImplInitCheckBoxData()
void CheckBox::ImplInit( Window* pParent, WinBits nStyle )
{
- nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ nStyle = ImplInitStyle(getPreviousSibling(pParent), nStyle);
Button::ImplInit( pParent, nStyle, NULL );
ImplInitSettings( true, true, true );