Skip to content

Commit da8e60d

Browse files
committed
Fixed null-ref exception when using PersistentStorage for the first time
1 parent 332e79d commit da8e60d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Editor/Util/PersistentStorage.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ private static void InvokeEventsWhenEditorIsReady()
166166
}
167167
finally
168168
{
169-
for (int i = Instance._afterReloadEvent.PersistentListeners.Count - 1; i >= 0; i--)
169+
if (Instance._afterReloadEvent.PersistentListeners != null)
170170
{
171-
Instance._afterReloadEvent.RemovePersistentListenerAt(i);
171+
for (int i = Instance._afterReloadEvent.PersistentListeners.Count - 1; i >= 0; i--)
172+
{
173+
Instance._afterReloadEvent.RemovePersistentListenerAt(i);
174+
}
172175
}
173176
}
174177
}

0 commit comments

Comments
 (0)