SynEdit: Fixed possible crash when PropertyEditor was updated after items where deselected

git-svn-id: trunk@18333 -
This commit is contained in:
martin 2009-01-18 19:46:05 +00:00
parent a47670f307
commit 8c0f2f5c04

View File

@ -264,8 +264,15 @@ procedure TSynObjectPartListPropertyEditorForm.UpdateButtons;
var
I: Integer;
begin
if SynObjectPartList = nil then begin
AddButton.Enabled := False;
DeleteButton.Enabled := False;
MoveUpButton.Enabled := False;
MoveDownButton.Enabled := False;
exit;
end;
I := SynObjectPartsListBox.ItemIndex;
AddButton.Enabled := SynObjectPartList <> nil;
AddButton.Enabled := True;
DeleteButton.Enabled := I > -1;
MoveUpButton.Enabled := I > 0;
MoveDownButton.Enabled := (I >= 0) and (I < SynObjectPartList.Count - 1);