Fix error when switching to a screen without an inventory gui widget (#24059)

(cherry picked from commit 6a7f1b2f1f52a8f88f8770a4c695292e5bebedff)
This commit is contained in:
DrSmugleaf 2024-01-13 19:18:28 -08:00 committed by Debug
parent 7d019f0418
commit c0edcf330c
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
1 changed files with 2 additions and 2 deletions

View File

@ -57,8 +57,8 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
if (UIManager.ActiveScreen == null)
return;
var inventoryGui = UIManager.GetActiveUIWidget<InventoryGui>();
RegisterInventoryButton(inventoryGui.InventoryButton);
if (UIManager.GetActiveUIWidgetOrNull<InventoryGui>() is { } inventoryGui)
RegisterInventoryButton(inventoryGui.InventoryButton);
}
public void OnStateEntered(GameplayState state)