Browse Source

set default result in TPCUWriter.IsExternalEl

Jinyang He 2 years ago
parent
commit
6b4ee224bf
1 changed files with 3 additions and 0 deletions
  1. 3 0
      packages/pastojs/src/pas2jsfiler.pp

+ 3 - 0
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