Added IList cast and null check

This commit is contained in:
David Higueros committed 2026-06-21 19:59:49 -06:00
1 parent e5658df8c5
commit 80b8af85cb
1 file changed
+11 -1
+11 -1
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -151,7 +152,16 @@ public static class ModdedOptionsManager
return;
}
var optionList = attribute.CreateOptionList(property.GetValue(group), property);
var propertyVal = property.GetValue(group);
if (propertyVal == null)
{
Error("Cannot initialize option list with null value.");
return;
}
var propertyList = (IList)propertyVal;
var optionList = attribute.CreateOptionList(propertyList, property);
if (optionList == null)
{