Error handling.

This commit is contained in:
Nuno Cruces
2023-01-25 14:59:02 +00:00
parent 191c1f53df
commit 921e1eafc2
10 changed files with 112 additions and 42 deletions

3
api.go
View File

@@ -16,6 +16,9 @@ func newConn(module api.Module) *Conn {
panic(noGlobalErr + "malloc_destructor")
}
destructor := uint32(global.Get())
if destructor == 0 {
panic(noGlobalErr + "malloc_destructor")
}
destructor, ok := module.Memory().ReadUint32Le(destructor)
if !ok {
panic(noGlobalErr + "malloc_destructor")