Skip to content

Commit

Permalink
Lib: Fix bad MetadataVersion on WasmMemoryBlock
Browse files Browse the repository at this point in the history
Closes #412
  • Loading branch information
SamboyCoding committed Jan 23, 2025
1 parent c0719eb commit 3f553f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions LibCpp2IL/Wasm/WasmMemoryBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ namespace LibCpp2IL.Wasm;
public class WasmMemoryBlock : ClassReadingBinaryReader
{
internal byte[] Bytes;
private WasmFile _file;

public override float MetadataVersion { get; }
//This isn't valid until Init() is called on the parent WasmFile, but that's fine, nothing should be referencing it until then.
public override float MetadataVersion => _file.MetadataVersion;

private static MemoryStream BuildStream(WasmFile file)
{
Expand All @@ -34,7 +36,7 @@ private static MemoryStream BuildStream(WasmFile file)

public WasmMemoryBlock(WasmFile file) : base(BuildStream(file))
{
MetadataVersion = file.MetadataVersion;
_file = file;
is32Bit = true;
Bytes = ((MemoryStream)BaseStream).ToArray();
}
Expand Down

0 comments on commit 3f553f5

Please sign in to comment.