]> git.sesse.net Git - vlc/commitdiff
- added a NULL pointer test
authorBoris Dorès <babal@videolan.org>
Fri, 24 Jan 2003 00:57:51 +0000 (00:57 +0000)
committerBoris Dorès <babal@videolan.org>
Fri, 24 Jan 2003 00:57:51 +0000 (00:57 +0000)
- cosmetic changes

modules/gui/win32/preferences.cpp

index 3c1713ae738519d5b7988fe79f4216a80e757251..c80972d98a01356fbe68b037ab0b6cab553e952f 100644 (file)
@@ -268,6 +268,11 @@ __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner,
         ButtonDown->Hint = "Decrease the plugin priority";\r
         ButtonDown->ShowHint = true;\r
     }\r
+    else\r
+    {\r
+        ButtonUp = NULL;\r
+        ButtonDown = NULL;\r
+    }\r
 \r
     /* panel height */\r
     Height = CleanCheckListBox->Top + CleanCheckListBox->Height\r
@@ -284,8 +289,8 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
      * started on an item */\r
     if( CleanCheckListBox->ItemIndex == -1 )\r
     {\r
-        ButtonUp->Enabled = false;\r
-        ButtonDown->Enabled = false;\r
+        if ( ButtonUp != NULL ) ButtonUp->Enabled = false;\r
+        if ( ButtonDown != NULL ) ButtonDown->Enabled = false;\r
         return;\r
     }\r
 \r
@@ -295,16 +300,13 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
         return;\r
 \r
     /* enable up and down buttons */\r
-    if ( b_multi_plugins )\r
+    if ( b_multi_plugins && ButtonUp != NULL && ButtonDown != NULL )\r
     {\r
-        if ( CleanCheckListBox->ItemIndex != -1 )\r
-        {\r
-            if ( CleanCheckListBox->ItemIndex == 0 )\r
-                ButtonUp->Enabled = false; else ButtonUp->Enabled = true;\r
-            if ( CleanCheckListBox->ItemIndex\r
-                == CleanCheckListBox->Items->Count - 1 )\r
-                ButtonDown->Enabled = false; else ButtonDown->Enabled = true;\r
-        }\r
+        if ( CleanCheckListBox->ItemIndex == 0 )\r
+            ButtonUp->Enabled = false; else ButtonUp->Enabled = true;\r
+        if ( CleanCheckListBox->ItemIndex\r
+            == CleanCheckListBox->Items->Count - 1 )\r
+            ButtonDown->Enabled = false; else ButtonDown->Enabled = true;\r
     }\r
 \r
     /* look for module 'Name' */\r