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

Commit 0274022

Browse files
committed
Make sure WaitForEndOfFrame object is never null
1 parent 211576e commit 0274022

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Core/Input/CursorUnlocker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public static void SetupAggressiveUnlock()
6262
}
6363
}
6464

65-
private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
65+
private static WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
6666

6767
private static IEnumerator AggressiveUnlockCoroutine()
6868
{
6969
while (true)
7070
{
71-
yield return _waitForEndOfFrame;
71+
yield return _waitForEndOfFrame ?? (_waitForEndOfFrame = new WaitForEndOfFrame());
7272

7373
if (UIManager.ShowMenu)
7474
UpdateCursorControl();

src/UI/Widgets/ScrollPool/ScrollPool.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,12 @@ public void Initialize(ICellPoolDataSource<T> dataSource, Action onHeightChanged
193193
RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener));
194194
}
195195

196-
private readonly WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
196+
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
197197

198198
private IEnumerator InitCoroutine(Action onHeightChangedListener)
199199
{
200200
ScrollRect.content.anchoredPosition = Vector2.zero;
201-
//yield return null;
202-
yield return waitForEndOfFrame;
201+
yield return waitForEndOfFrame ?? (waitForEndOfFrame = new WaitForEndOfFrame());
203202

204203
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
205204

0 commit comments

Comments
 (0)