File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Cpp2IL.Core/Model/Contexts Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,13 @@ private void InitPre29AttributeGeneratorAnalysis(int rangeIndex)
137
137
{
138
138
ulong generatorPtr ;
139
139
if ( AppContext . MetadataVersion < 27 )
140
+ {
141
+ if ( rangeIndex < 0 )
142
+ {
143
+ RawIl2CppCustomAttributeData = Array . Empty < byte > ( ) ;
144
+ return ;
145
+ }
146
+
140
147
try
141
148
{
142
149
generatorPtr = AppContext . Binary . GetCustomAttributeGenerator ( rangeIndex ) ;
@@ -147,6 +154,7 @@ private void InitPre29AttributeGeneratorAnalysis(int rangeIndex)
147
154
RawIl2CppCustomAttributeData = Array . Empty < byte > ( ) ;
148
155
return ;
149
156
}
157
+ }
150
158
else
151
159
{
152
160
var baseAddress = CustomAttributeAssembly . CodeGenModule ! . customAttributeCacheGenerator ;
@@ -204,7 +212,7 @@ public void AnalyzeCustomAttributeData(bool allowAnalysis = true)
204
212
205
213
//Basically, extract actions from the analysis, and compare with the type list we have to resolve parameters and populate the CustomAttributes list.
206
214
207
- foreach ( var il2CppType in AttributeTypes ! ) //Assert nonnull because we're pre-29 at this point
215
+ foreach ( var il2CppType in AttributeTypes ?? [ ] ) //Can be null for injected objects
208
216
{
209
217
var typeDef = il2CppType . AsClass ( ) ;
210
218
var attributeTypeContext = AppContext . ResolveContextForType ( typeDef ) ?? throw new ( "Unable to find type " + typeDef . FullName ) ;
You can’t perform that action at this time.
0 commit comments