浏览代码

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

Required for UnityEditor 2020.1.10

Fixes #9946
Rudy Ges 4 年之前
父节点
当前提交
65bb88834c
共有 1 个文件被更改,包括 5 次插入2 次删除
  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)