From 4bc921d47e8d48533fb068ce142c92334b4b9fb6 Mon Sep 17 00:00:00 2001 From: PopSlime Date: Sat, 8 Apr 2023 13:39:00 +0800 Subject: [PATCH] Fix error on element/property list is null. --- Assets/Cryville/Common/Pdt/PdtInterpreter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Cryville/Common/Pdt/PdtInterpreter.cs b/Assets/Cryville/Common/Pdt/PdtInterpreter.cs index ad6f6af..7eebc51 100644 --- a/Assets/Cryville/Common/Pdt/PdtInterpreter.cs +++ b/Assets/Cryville/Common/Pdt/PdtInterpreter.cs @@ -271,7 +271,9 @@ namespace Cryville.Common.Pdt { if (prop == null) throw new MissingMemberException(string.Format("The property \"{0}\" is not found", pkey)); Type ptype = ReflectionHelper.GetMemberType(prop); if (flag) { - using (var collection = new PairCollection(ReflectionHelper.GetValue(prop, result))) { + var origCollection = ReflectionHelper.GetValue(prop, result); + if (origCollection == null) origCollection = Activator.CreateInstance(ptype); + using (var collection = new PairCollection(origCollection)) { var ktype = ptype.GetGenericArguments()[0]; var vtype = ptype.GetGenericArguments()[1]; object key = _binder.ChangeType(pkey, ktype, null);