Skip to content

Commit

Permalink
Merge pull request #21 from LunaTheFoxgirl/master
Browse files Browse the repository at this point in the history
Fix crash on class deserialization
  • Loading branch information
9il authored Mar 24, 2022
2 parents 73f9df2 + 6ac0977 commit 5ebebdd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/asdf/serialization.d
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ unittest
V deserialize(V)(Asdf data)
{
V value;
static if (is(V == class)) value = new V;
if (auto exc = deserializeValue(data, value))
throw exc;
return value;
Expand Down Expand Up @@ -2281,6 +2282,7 @@ SerdeException deserializeValue(V : T[], T)(Asdf data, ref V value)
value = new T[elems.save.count];
foreach(ref e; value)
{
static if(is(T == class)) e = new T;
if (auto exc = .deserializeValue(elems.front, e))
return exc;
elems.popFront;
Expand Down

0 comments on commit 5ebebdd

Please sign in to comment.