diff --git a/wasm/tts/sherpa-onnx-tts.js b/wasm/tts/sherpa-onnx-tts.js index e08c9e8d..5c09050c 100644 --- a/wasm/tts/sherpa-onnx-tts.js +++ b/wasm/tts/sherpa-onnx-tts.js @@ -21,7 +21,7 @@ function freeConfig(config, Module) { // The user should free the returned pointers function initSherpaOnnxOfflineTtsVitsModelConfig(config, Module) { - const modelLen = Module.lengthBytesUTF8(config.model) + 1; + const modelLen = Module.lengthBytesUTF8(config.model || '')+ 1; const lexiconLen = Module.lengthBytesUTF8(config.lexicon || '') + 1; const tokensLen = Module.lengthBytesUTF8(config.tokens || '') + 1; const dataDirLen = Module.lengthBytesUTF8(config.dataDir || '') + 1;