Răsfoiți Sursa

[eval] don't throw upon casting (null:String) to NativeString

Aleksandr Kuzmenko 4 ani în urmă
părinte
comite
8ff7c404f8
1 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 3 2
      src/macro/eval/evalStdLib.ml

+ 3 - 2
src/macro/eval/evalStdLib.ml

@@ -3075,8 +3075,9 @@ end
 
 module StdNativeString = struct
 	let from_string = vfun1 (fun v ->
-		let s = decode_vstring v in
-		vnative_string s.sstring
+		match decode_optional decode_vstring v with
+		| None -> vnull
+		| Some s -> vnative_string s.sstring
 	)
 
 	let from_bytes = vfun1 (fun v ->