mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 17:58:05 +02:00
IDE: added a sanity check about if ListView.Selected is assigned. Issue #19819
git-svn-id: trunk@33595 -
This commit is contained in:
parent
a002250d2b
commit
e597ae1306
@ -203,26 +203,27 @@ begin
|
||||
NewFile:=TNewItemProjectFile(FNewItem);
|
||||
if (NewFile.Descriptor is TFileDescInheritedItem) then
|
||||
begin
|
||||
AInheritedNode := nil;
|
||||
// If we are inheriting from a form
|
||||
if (NewFile.Descriptor is TFileDescInheritedComponent) then begin
|
||||
InhCompItem:=TFileDescInheritedComponent(NewFile.Descriptor);
|
||||
AInheritedNode := InheritableComponentsListView.Selected;
|
||||
// load the ancestor component
|
||||
AnUnitInfo:=TUnitInfo(AInheritedNode.Data);
|
||||
if LazarusIDE.DoOpenComponent(AnUnitInfo.Filename,
|
||||
[ofOnlyIfExists,ofQuiet,ofLoadHiddenResource,ofUseCache],[],
|
||||
AncestorComponent)<>mrOk then
|
||||
begin
|
||||
MessageDlg(lisErrorOpeningComponent,
|
||||
lisUnableToOpenAncestorComponent, mtError, [mbCancel], 0);
|
||||
exit;
|
||||
if Assigned(AInheritedNode) then begin
|
||||
// load the ancestor component
|
||||
AnUnitInfo:=TUnitInfo(AInheritedNode.Data);
|
||||
if LazarusIDE.DoOpenComponent(AnUnitInfo.Filename,
|
||||
[ofOnlyIfExists,ofQuiet,ofLoadHiddenResource,ofUseCache],[],
|
||||
AncestorComponent)<>mrOk then
|
||||
begin
|
||||
MessageDlg(lisErrorOpeningComponent,
|
||||
lisUnableToOpenAncestorComponent, mtError, [mbCancel], 0);
|
||||
exit;
|
||||
end;
|
||||
// Set the resource class of the file descriptor
|
||||
InhCompItem.ResourceClass := TPersistentClass(AncestorComponent.ClassType);
|
||||
InhCompItem.InheritedUnit := AnUnitInfo;
|
||||
InhCompItem.DeclareClassVariable := not AncestorComponent.ClassType.InheritsFrom(TFrame);
|
||||
//DebugLn(['TNewOtherDialog.OKButtonClick ',InhCompItem.InheritedUnit.Filename,' ',dbgsname(InhCompItem.ResourceClass)]);
|
||||
end;
|
||||
// Set the resource class of the file descriptor
|
||||
InhCompItem.ResourceClass := TPersistentClass(AncestorComponent.ClassType);
|
||||
InhCompItem.InheritedUnit := AnUnitInfo;
|
||||
InhCompItem.DeclareClassVariable := not AncestorComponent.ClassType.InheritsFrom(TFrame);
|
||||
//DebugLn(['TNewOtherDialog.OKButtonClick ',InhCompItem.InheritedUnit.Filename,' ',dbgsname(InhCompItem.ResourceClass)]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user