Skip to content

Commit

Permalink
actually fix null exception error on selecting last pack
Browse files Browse the repository at this point in the history
- behaviour is the same anyways, since it just quickly terminates, but
  at least there aren't any error messages now
  • Loading branch information
chrislee0419 committed Aug 18, 2020
1 parent 26d7719 commit 2124443
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions UI/SongListUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ private void SelectSavedLevelPack()

TabBarViewController tabBarVC = LevelFilteringNavigationController.GetPrivateField<TabBarViewController>("_tabBarViewController");
TabBarViewController.TabBarItem[] tabBarItems = tabBarVC.GetPrivateField<TabBarViewController.TabBarItem[]>("_items");
if (tabBarItems == null)
goto OnError;

var item = tabBarItems.FirstOrDefault(x => x.title == lastLevelPackCollectionTitle);
if (item == null)
goto OnError;
Expand All @@ -153,6 +156,9 @@ private void SelectSavedLevelPack()
goto OnError;

var levelPacks = tabBarDatas[itemIndex].GetField<IAnnotatedBeatmapLevelCollection[]>("annotatedBeatmapLevelCollections");
if (levelPacks == null)
goto OnError;

IAnnotatedBeatmapLevelCollection levelPack = levelPacks.FirstOrDefault(x => x.collectionName == lastLevelPackID || (x is IBeatmapLevelPack && ((IBeatmapLevelPack)x).packID == lastLevelPackID));
if (levelPack == null)
goto OnError;
Expand Down

0 comments on commit 2124443

Please sign in to comment.