Skip to content

Commit

Permalink
Fixed places where ReferenceEquals was not working and generating a
Browse files Browse the repository at this point in the history
nullRef
  • Loading branch information
linuxgurugamer authored and LGhassen committed Aug 14, 2022
1 parent 6e42276 commit 3124f0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public void SwitchScaledMode()

public void Cleanup()
{
if (!ReferenceEquals (scaledScatteringMR, null))
if (scaledScatteringMR != null)
{
scaledScatteringMR.enabled = false;
UnityEngine.Component.Destroy (scaledScatteringMR);
}

if (!ReferenceEquals (scaledScatteringGO, null))
if (scaledScatteringGO != null)
UnityEngine.Object.Destroy(scaledScatteringGO);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ public void Resize(float size)

public void Cleanup()
{
if (!ReferenceEquals (skySphereMR, null))
if (skySphereMR != null)
{
skySphereMR.enabled = false;
UnityEngine.Component.DestroyImmediate (skySphereMR);
}

if (!ReferenceEquals (skySphereGO, null))
if (skySphereGO != null)
{
UnityEngine.Object.DestroyImmediate(skySphereGO);
}
Expand Down
4 changes: 2 additions & 2 deletions scatterer/Utilities/Camera/ScreenCopyCommandBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ void OnPostRender()

public void OnDestroy ()
{
if (!ReferenceEquals(targetCamera,null))
if (targetCamera != null)
{
if (!ReferenceEquals(screenCopyCommandBuffer,null))
if (screenCopyCommandBuffer != null)
{
targetCamera.RemoveCommandBuffer (CameraEvent.AfterImageEffectsOpaque, screenCopyCommandBuffer);
colorCopyRenderTexture.Release();
Expand Down

0 comments on commit 3124f0c

Please sign in to comment.