fix randomly crash by stack overflow

This commit is contained in:
ekibun
2020-10-07 00:15:57 +08:00
parent d294dd59bc
commit ee934184ac
8 changed files with 32 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
* @Author: ekibun
* @Date: 2020-09-19 10:29:04
* @LastEditors: ekibun
* @LastEditTime: 2020-10-03 23:27:15
* @LastEditTime: 2020-10-06 23:13:13
*/
import 'dart:ffi';
import 'dart:io';
@@ -478,6 +478,7 @@ String jsToCString(
Pointer val,
) {
var ptr = _jsToCString(ctx, val);
if (ptr.address == 0) throw Exception("JSValue cannot convert to string");
var str = Utf8.fromUtf8(ptr);
jsFreeCString(ctx, ptr);
return str;