Skip to content

Commit

Permalink
Merge pull request #52 from mackysoft/fix/nullreference-when-fromjson
Browse files Browse the repository at this point in the history
Fixed a bug when trying to deserialize a null type with FromJson.
  • Loading branch information
mackysoft committed Feb 16, 2024
2 parents e5a5157 + f781ad7 commit 2934eea
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class ManagedReferenceUtility {

#if UNITY_2021_3_OR_NEWER
// NOTE: managedReferenceValue getter is available only in Unity 2021.3 or later.
if (property.managedReferenceValue != null)
if (property.managedReferenceValue != null && type != null)
{
// Restore an previous values from json.
string json = JsonUtility.ToJson(property.managedReferenceValue);
Expand Down

0 comments on commit 2934eea

Please sign in to comment.