Commit 72fb9033 authored by Boris Dorès's avatar Boris Dorès

- added a NULL pointer test

- cosmetic changes
parent e56eff61
...@@ -268,6 +268,11 @@ __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner, ...@@ -268,6 +268,11 @@ __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner,
ButtonDown->Hint = "Decrease the plugin priority"; ButtonDown->Hint = "Decrease the plugin priority";
ButtonDown->ShowHint = true; ButtonDown->ShowHint = true;
} }
else
{
ButtonUp = NULL;
ButtonDown = NULL;
}
/* panel height */ /* panel height */
Height = CleanCheckListBox->Top + CleanCheckListBox->Height Height = CleanCheckListBox->Top + CleanCheckListBox->Height
...@@ -284,8 +289,8 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender ) ...@@ -284,8 +289,8 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
* started on an item */ * started on an item */
if( CleanCheckListBox->ItemIndex == -1 ) if( CleanCheckListBox->ItemIndex == -1 )
{ {
ButtonUp->Enabled = false; if ( ButtonUp != NULL ) ButtonUp->Enabled = false;
ButtonDown->Enabled = false; if ( ButtonDown != NULL ) ButtonDown->Enabled = false;
return; return;
} }
...@@ -295,16 +300,13 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender ) ...@@ -295,16 +300,13 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
return; return;
/* enable up and down buttons */ /* 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 == 0 ) if ( CleanCheckListBox->ItemIndex
ButtonUp->Enabled = false; else ButtonUp->Enabled = true; == CleanCheckListBox->Items->Count - 1 )
if ( CleanCheckListBox->ItemIndex ButtonDown->Enabled = false; else ButtonDown->Enabled = true;
== CleanCheckListBox->Items->Count - 1 )
ButtonDown->Enabled = false; else ButtonDown->Enabled = true;
}
} }
/* look for module 'Name' */ /* look for module 'Name' */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment