Fix error on element/property list is null. (2)
This commit is contained in:
@@ -272,7 +272,9 @@ namespace Cryville.Common.Pdt {
|
|||||||
Type ptype = ReflectionHelper.GetMemberType(prop);
|
Type ptype = ReflectionHelper.GetMemberType(prop);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
var origCollection = ReflectionHelper.GetValue(prop, result);
|
var origCollection = ReflectionHelper.GetValue(prop, result);
|
||||||
if (origCollection == null) origCollection = Activator.CreateInstance(ptype);
|
if (origCollection == null) {
|
||||||
|
ReflectionHelper.SetValue(prop, result, origCollection = Activator.CreateInstance(ptype));
|
||||||
|
}
|
||||||
using (var collection = new PairCollection(origCollection)) {
|
using (var collection = new PairCollection(origCollection)) {
|
||||||
var ktype = ptype.GetGenericArguments()[0];
|
var ktype = ptype.GetGenericArguments()[0];
|
||||||
var vtype = ptype.GetGenericArguments()[1];
|
var vtype = ptype.GetGenericArguments()[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user