Browse Source

* fixed another crash in the wasi internal linker, caused by missing resource section

Nikolay Nikolov 1 year ago
parent
commit
c88037b8a7
1 changed files with 6 additions and 3 deletions
  1. 6 3
      compiler/ogwasm.pas

+ 6 - 3
compiler/ogwasm.pas

@@ -4644,14 +4644,17 @@ implementation
         begin
           DataCount:=0;
           for DataSecName in DataSections do
-            if FindExeSection(DataSecName).Size>0 then
-              Inc(DataCount);
+            begin
+              ExeSec:=FindExeSection(DataSecName);
+              if Assigned(ExeSec) and (ExeSec.Size>0) then
+                Inc(DataCount);
+            end;
           WriteUleb(FWasmSections[wsiDataCount],DataCount);
           WriteUleb(FWasmSections[wsiData],DataCount);
           for DataSecName in DataSections do
             begin
               ExeSec:=FindExeSection(DataSecName);
-              if ExeSec.Size>0 then
+              if Assigned(ExeSec) and (ExeSec.Size>0) then
                 WriteExeSection(ExeSec);
             end;
         end;