Browse Source

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

Required for UnityEditor 2020.1.10

Fixes #9946
Rudy Ges 4 năm trước cách đây
mục cha
commit
65bb88834c
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  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
 			pos, InstConstant (cons)
 		| 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 ->
 			let pos, len = read_compressed_i32 s pos in
 			pos+len, InstType (String.sub s pos len)