aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/preamble.js1
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);