Skip to content

Commit ac81f86

Browse files
committed
修复webgl的throw null用例
1 parent df90705 commit ac81f86

File tree

2 files changed

+94
-89
lines changed

2 files changed

+94
-89
lines changed

unity/Assets/webgl/upm/Javascripts~/PuertsDLLMock/dist/puerts-runtime.js

Lines changed: 90 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unity/Assets/webgl/upm/Javascripts~/PuertsDLLMock/pesapiImpl.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,10 @@ export function WebGLFFIApi(engine: PuertsJSEngine) {
11101110

11111111
function TranToString(pvalue: pesapi_value): void {
11121112
const value = Scope.getCurrent().toJs(engine.unityApi, objMapper, pvalue);
1113-
const str = value.toString();
1113+
if (typeof value == 'undefined') {
1114+
1115+
}
1116+
const str = (typeof value === 'undefined') ? "undefined" : ( value === null ? "null" : value.toString());
11141117
jsValueToPapiValue(engine.unityApi, str, pvalue);
11151118
}
11161119

0 commit comments

Comments
 (0)