[wasm][bindings] Fix an api regression introduced in #42486 (#42658)
authorLarry Ewing <lewing@microsoft.com>
Thu, 24 Sep 2020 04:35:51 +0000 (23:35 -0500)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 04:35:51 +0000 (23:35 -0500)
* Fix an api regression introduced in #42486

* Update src/mono/wasm/runtime/binding_support.js

a number it is

Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
src/mono/wasm/runtime/binding_support.js

index 05ac8ef..5d79755 100644 (file)
@@ -142,6 +142,9 @@ var BindingSupportLib = {
                },
 
                js_string_to_mono_string: function (string) {
+                       if (string === null || typeof string === "undefined")
+                               return 0;
+
                        var buffer = Module._malloc ((string.length + 1) * 2);
                        var buffer16 = (buffer / 2) | 0;
                        for (var i = 0; i < string.length; i++)