diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-06-11 18:43:20 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-06-11 18:43:20 -0700 |
commit | 9a773a00e1d2f95e4c8f7b66bf3a893b33868141 (patch) | |
tree | dd453b5609b1ee9765ec6b3a0b4f1bff78118efd | |
parent | ae8adbae419d2a14c8a7df45542c60630a11d918 (diff) |
handle null strings in ccall
-rw-r--r-- | src/preamble.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 45ae0b4d..ae00b796 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -326,6 +326,7 @@ function ccall(ident, returnType, argTypes, args) { var stack = 0; function toC(value, type) { if (type == 'string') { + if (value === null || value === undefined || value === 0) return 0; // null string if (!stack) stack = Runtime.stackSave(); var ret = Runtime.stackAlloc(value.length+1); writeStringToMemory(value, ret); |