From: Boris Dorès Date: Fri, 24 Jan 2003 00:57:51 +0000 (+0000) Subject: - added a NULL pointer test X-Git-Tag: 0.5.0~182 X-Git-Url: https://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=72fb9033d1a80749ec45f45eb7b69fa1d7170536;ds=sidebyside - added a NULL pointer test - cosmetic changes --- diff --git a/modules/gui/win32/preferences.cpp b/modules/gui/win32/preferences.cpp index 3c1713ae73..c80972d98a 100644 --- a/modules/gui/win32/preferences.cpp +++ b/modules/gui/win32/preferences.cpp @@ -268,6 +268,11 @@ __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner, ButtonDown->Hint = "Decrease the plugin priority"; ButtonDown->ShowHint = true; } + else + { + ButtonUp = NULL; + ButtonDown = NULL; + } /* panel height */ Height = CleanCheckListBox->Top + CleanCheckListBox->Height @@ -284,8 +289,8 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender ) * started on an item */ if( CleanCheckListBox->ItemIndex == -1 ) { - ButtonUp->Enabled = false; - ButtonDown->Enabled = false; + if ( ButtonUp != NULL ) ButtonUp->Enabled = false; + if ( ButtonDown != NULL ) ButtonDown->Enabled = false; return; } @@ -295,16 +300,13 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender ) return; /* enable up and down buttons */ - if ( b_multi_plugins ) + if ( b_multi_plugins && ButtonUp != NULL && ButtonDown != NULL ) { - if ( CleanCheckListBox->ItemIndex != -1 ) - { - if ( CleanCheckListBox->ItemIndex == 0 ) - ButtonUp->Enabled = false; else ButtonUp->Enabled = true; - if ( CleanCheckListBox->ItemIndex - == CleanCheckListBox->Items->Count - 1 ) - ButtonDown->Enabled = false; else ButtonDown->Enabled = true; - } + if ( CleanCheckListBox->ItemIndex == 0 ) + ButtonUp->Enabled = false; else ButtonUp->Enabled = true; + if ( CleanCheckListBox->ItemIndex + == CleanCheckListBox->Items->Count - 1 ) + ButtonDown->Enabled = false; else ButtonDown->Enabled = true; } /* look for module 'Name' */