Răsfoiți Sursa

[ilib] Handle null value in System.Type instance (#9948)

Required for UnityEditor 2020.1.10

Fixes #9946
Rudy Ges 4 ani în urmă
părinte
comite
65bb88834c
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      libs/ilib/ilMetaReader.ml

+ 5 - 2
libs/ilib/ilMetaReader.ml

@@ -1556,8 +1556,11 @@ let read_custom_attr ctx attr_type s pos =
 			let pos, cons = read_constant ctx (sig_to_const ilsig) s pos in
 			let pos, cons = read_constant ctx (sig_to_const ilsig) s pos in
 			pos, InstConstant (cons)
 			pos, InstConstant (cons)
 		| SClass c when is_type (["System"],"Type") c ->
 		| SClass c when is_type (["System"],"Type") c ->
-			let pos, len = read_compressed_i32 s pos in
-			pos+len, InstType (String.sub s pos len)
+			if (sget s pos) == 0xff then
+				pos+1, InstConstant INull
+			else
+				let pos, len = read_compressed_i32 s pos in
+				pos+len, InstType (String.sub s pos len)
 		| SType ->
 		| SType ->
 			let pos, len = read_compressed_i32 s pos in
 			let pos, len = read_compressed_i32 s pos in
 			pos+len, InstType (String.sub s pos len)
 			pos+len, InstType (String.sub s pos len)