Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 8afc17a

Browse files
committed
Fixed a potential nullptr when a profile is assigned to a disabled camera
1 parent 9143575 commit 8afc17a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

PostProcessing/Runtime/PostProcessingBehaviour.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ void OnPreCull()
8585
// All the per-frame initialization logic has to be done in OnPreCull instead of Update
8686
// because [ImageEffectAllowedInSceneView] doesn't trigger Update events...
8787

88-
if (profile == null)
89-
return;
90-
9188
m_Camera = GetComponent<Camera>();
9289

90+
if (profile == null || m_Camera == null)
91+
return;
92+
9393
#if UNITY_EDITOR
9494
// Track the scene view camera to disable some effects we don't want to see in the
9595
// scene view
@@ -175,7 +175,7 @@ void OnPreRender()
175175

176176
void OnPostRender()
177177
{
178-
if (profile == null)
178+
if (profile == null || m_Camera == null)
179179
return;
180180

181181
// TAA messes with the projection matrix, so reset it before the classic post-processing
@@ -188,7 +188,7 @@ void OnPostRender()
188188
[ImageEffectTransformsToLDR]
189189
void OnRenderImage(RenderTexture source, RenderTexture destination)
190190
{
191-
if (profile == null)
191+
if (profile == null || m_Camera == null)
192192
{
193193
Graphics.Blit(source, destination);
194194
return;
@@ -277,7 +277,7 @@ void OnGUI()
277277
if (Event.current.type != EventType.Repaint)
278278
return;
279279

280-
if (profile == null)
280+
if (profile == null || m_Camera == null)
281281
return;
282282

283283
if (m_EyeAdaptation.active && profile.debugViews.IsModeActive(DebugMode.EyeAdaptation))

0 commit comments

Comments
 (0)