Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit c927ac5

Browse files
committed
Fix potential NullReference in UpdateMouseInspect
1 parent 9f1df11 commit c927ac5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Inspectors/MouseInspectors/WorldInspector.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ public override void OnSelectMouseInspect()
3535

3636
public override void UpdateMouseInspect(Vector2 mousePos)
3737
{
38+
if (!MainCamera)
39+
MainCamera = Camera.main;
40+
if (!MainCamera)
41+
{
42+
ExplorerCore.LogWarning("No Main Camera was found, unable to inspect world!");
43+
InspectUnderMouse.Instance.StopInspect();
44+
return;
45+
}
46+
3847
var ray = MainCamera.ScreenPointToRay(mousePos);
3948
Physics.Raycast(ray, out RaycastHit hit, 1000f);
4049

0 commit comments

Comments
 (0)