Skip to content

Commit 81ff655

Browse files
committed
Make sure table, function and memory sections exist when populating their index spaces
1 parent 195c3b8 commit 81ff655

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

section_structs.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,17 @@ def __init__(self, type_section, import_section, function_section,
256256
if entry.kind == External_Kind.GLOBAL:
257257
self.global_index_space.append(entry)
258258

259-
for entry in self.function_section.type_section_index:
260-
self.function_index_space.append(entry)
259+
if self.function_section is not None:
260+
for entry in self.function_section.type_section_index:
261+
self.function_index_space.append(entry)
261262

262-
for entry in self.table_section.table_types:
263-
self.table_index_space.append(entry)
263+
if self.table_section is not None:
264+
for entry in self.table_section.table_types:
265+
self.table_index_space.append(entry)
264266

265-
for entry in self.memory_section.memory_types:
266-
self.memory_index_space.append(entry)
267+
if self.memory_section is not None:
268+
for entry in self.memory_section.memory_types:
269+
self.memory_index_space.append(entry)
267270

268271
if self.global_section is not None:
269272
for entry in self.global_section.global_variables:

0 commit comments

Comments
 (0)