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

Commit 084aee6

Browse files
committed
Prevent null reference if Canvas isn't created yet
1 parent d0e5087 commit 084aee6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Core/Input/CursorUnlocker.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ private static void SetupPatches()
160160

161161
public static void Prefix_EventSystem_set_current(ref EventSystem value)
162162
{
163+
if (!UIManager.EventSys)
164+
{
165+
if (value)
166+
{
167+
lastEventSystem = value;
168+
lastInputModule = value.currentInputModule;
169+
}
170+
return;
171+
}
172+
163173
if (!settingEventSystem && value != UIManager.EventSys)
164174
{
165175
lastEventSystem = value;

0 commit comments

Comments
 (0)