Fix error on attempt to reload actions when the game is shutting down.

This commit is contained in:
2023-12-19 16:40:59 +08:00
parent 55dd38fb2c
commit 50879a1f3f

View File

@@ -37,10 +37,12 @@ namespace Cryville.Crtr.Browsing.UI {
readonly HashSet<int> _selectedItems = new HashSet<int>();
readonly Dictionary<int, BrowserItem> _items = new Dictionary<int, BrowserItem>();
bool _destroyed;
protected virtual void Start() {
m_itemContainer.LoadItem = LoadItem;
}
void OnDestroy() {
_destroyed = true;
UnregisterManager();
}
void UnregisterManager() {
@@ -124,6 +126,7 @@ namespace Cryville.Crtr.Browsing.UI {
}
}
internal override void OnActionsChanged() {
if (_destroyed) return;
if (_selectedItems.Count == 1) {
LoadActions(_manager[_selectedItems.Single()]);
}