Merge pull request #52 from mackysoft/fix/nullreference-when-fromjson

Fixed a bug when trying to deserialize a null type with FromJson.
This commit is contained in:
Makihiro 2024-02-16 21:58:54 +09:00 committed by GitHub
commit 2934eea84e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,7 @@ namespace MackySoft.SerializeReferenceExtensions.Editor {
#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);