From d94af60665971d5c51f6b391f7c76d5c7424773d Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Tue, 28 Nov 2017 17:45:00 -0500 Subject: [PATCH] Add some null checks --- PostFX/Editor/CinemachinePostProcessingEditor.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PostFX/Editor/CinemachinePostProcessingEditor.cs b/PostFX/Editor/CinemachinePostProcessingEditor.cs index 7306d5332..b22dbad13 100644 --- a/PostFX/Editor/CinemachinePostProcessingEditor.cs +++ b/PostFX/Editor/CinemachinePostProcessingEditor.cs @@ -43,11 +43,14 @@ void OnEnable() void OnDisable() { - m_EffectList.Clear(); + if (m_EffectList != null) + m_EffectList.Clear(); } void RefreshEffectListEditor(PostProcessProfile asset) { + if (m_EffectList == null) + m_EffectList = new EffectListEditor(this); m_EffectList.Clear(); if (asset != null) m_EffectList.Init(asset, new SerializedObject(asset)); @@ -161,7 +164,7 @@ void DrawProfileInspectorGUI() if (m_Profile.objectReferenceValue == null) { - if (assetHasChanged) + if (assetHasChanged && m_EffectList != null) m_EffectList.Clear(); // Asset wasn't null before, do some cleanup EditorGUILayout.HelpBox( @@ -172,7 +175,8 @@ void DrawProfileInspectorGUI() { if (assetHasChanged) RefreshEffectListEditor((PostProcessProfile)m_Profile.objectReferenceValue); - m_EffectList.OnGUI(); + if (m_EffectList != null) + m_EffectList.OnGUI(); } } }