wasi: do not crash if argc is 0

Instead, leave args at its default value (which provides a fake argv[0] as it has for a long time).

linux and mac do not seem affected.

Fixes #1862 (tinygo apps after v0.17.0-113-g7b761fa crash if run without argv[0])
This commit is contained in:
Dan Kegel
2021-05-05 08:33:16 -07:00
committed by Ron Evans
parent 959442dc82
commit 8dfefb46d1
+3
View File
@@ -30,6 +30,9 @@ func init() {
// these args (argv).
var argc, argv_buf_size uint32
args_sizes_get(&argc, &argv_buf_size)
if argc == 0 {
return
}
// Obtain the command line arguments
argsSlice := make([]unsafe.Pointer, argc)