diff --git a/packages/pastojs/src/pas2jsfiler.pp b/packages/pastojs/src/pas2jsfiler.pp index 2a52db563b..868e3240c8 100644 --- a/packages/pastojs/src/pas2jsfiler.pp +++ b/packages/pastojs/src/pas2jsfiler.pp @@ -3350,6 +3350,7 @@ function TPCUWriter.IsExternalEl(El: TPasElement): boolean; var C: TClass; begin + Result:=false; while El<>nil do begin C:=El.ClassType; @@ -3477,6 +3478,8 @@ begin ParentRef:=WriteExternalReference(SpecItem.GenericEl,aContext) else if IsExternalEl(Parent) then ParentRef:=WriteExternalReference(Parent,aContext) + else if Parent=nil then + ParentRef:=nil else begin // El is external, Parent is not