1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 06:19:38 +08:00
osu-lazer/osu.Game
Dean Herbert 0267aed846 Change ToMod to return an UnknownMod rather than throw if a mod isn't available
As seen by this kind of crash, having the `.ToMod` method throw can be
very problematic and also hidden (as it is used inside of models in
places where exceptions are not expected to occur).

Given there are tens of usages of this method, returning a placeholder
mod seems like a better idea than outright throwing.

```
 An unhandled has occurred.
 System.InvalidOperationException:
There is no mod in the ruleset (osu) matching the acronym AS.
 at osu.Game.Online.API.APIMod.ToMod(Ruleset ruleset) in /Users/dean/Projects/osu/osu.Game/Online/API/APIMod.cs:line 54
 at osu.Game.Scoring.ScoreInfo.<get_Mods>b__117_0(APIMod m) in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
 at osu.Game.Scoring.ScoreInfo.get_Mods() in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c.<subscribeToLocalScores>b__40_2(ScoreInfo s) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line 199
 at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
 at osu.Game.Database.RealmObjectExtensions.Detach[T](IEnumerable`1 items) in /Users/dean/Projects/osu/osu.Game/Database/RealmObjectExtensions.cs:line 180
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c__DisplayClass40_0.<subscribeToLocalScores>g__localScoresChanged|1(IRealmCollection`1 sender, ChangeSet changes, Exception exception) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line
209
 at Realms.RealmCollectionBase`1.Realms.INotifiable<Realms.NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(Nullable`1 changes, Nullable`1 exception)
 at Realms.NotifiableObjectHandleBase.NotifyObjectChanged(IntPtr managedHandle, IntPtr changes, IntPtr exception)
```
2022-03-09 17:57:55 +09:00
..
Audio Clean up unused resolved properties 2021-12-03 18:49:49 +09:00
Beatmaps Merge branch 'master' into ruleset-leaderboard-unavailable 2022-03-03 22:52:20 +01:00
Collections Block collection loading until realm migration has completed 2022-01-27 00:34:51 +09:00
Configuration Revert "Fix potential crash in tests when attempting to lookup key bindings in cases the lookup is not available" 2022-03-05 16:42:51 +01:00
Database Remove unused variable 2022-03-08 18:19:54 +09:00
Extensions Convert to extension method to avoid recursive calls 2022-03-03 14:15:37 +09:00
Graphics Merge pull request #17115 from frenzibyte/manual-channel-scroll 2022-03-07 11:26:23 +09:00
Input Add replay statistics frames to FramedReplayInputHandler 2022-01-31 18:53:47 +09:00
IO Merge branch 'master' into net6 2022-02-14 22:06:35 +09:00
IPC Update IPC usage to return null 2021-12-03 14:30:15 +09:00
Localisation Merge pull request #17073 from peppy/add-offset-adjust-tooltip-text 2022-03-05 23:28:24 +09:00
Migrations Revert "Remove all EF migrations" 2022-01-29 23:13:23 +09:00
Models Add support for creating new blank difficulties 2022-02-02 21:55:33 +01:00
Online Change ToMod to return an UnknownMod rather than throw if a mod isn't available 2022-03-09 17:57:55 +09:00
Overlays Merge pull request #17161 from smoogipoo/fix-listing-score-conversion 2022-03-09 13:32:45 +09:00
Performance Add LocalUserPlayInfo interface to convey common information about player status 2021-08-17 16:15:47 +09:00
Properties Merge remote-tracking branch 'upstream/master' into android 2019-01-29 18:13:43 -06:00
Replays
Rulesets Change ToMod to return an UnknownMod rather than throw if a mod isn't available 2022-03-09 17:57:55 +09:00
Scoring Fix scores not being recalculated in beatmap listing 2022-03-08 19:07:39 +09:00
Screens Fix BeatmapLeaderboard refreshing on unrelated changes to a beatmap 2022-03-08 14:50:47 +09:00
Skinning Merge branch 'master' into scaling-container-better-custom-override 2022-03-03 22:32:23 +01:00
Stores Rename parameter to match other usages 2022-02-08 20:35:38 +09:00
Storyboards Make mods argument optional for storyboard construction 2022-03-04 12:05:02 +09:00
Tests Add failing test case 2022-03-02 20:32:41 +03:00
Updater Fix clear identifier typos 2021-12-27 20:26:28 -08:00
Users Fix avatar not clickable after watching replay 2022-03-09 14:39:02 +09:00
Utils Implement best-name-finding helper method 2022-02-17 00:28:17 +01:00
.editorconfig Add localisation license header to editorconfig 2021-08-02 11:44:10 +09:00
osu!.res
osu.Game.csproj Merge branch 'master' into add-display-choice-dropdown 2022-03-05 14:39:59 +01:00
OsuGame.cs Enable high chat polling rate 2022-02-25 16:03:56 +09:00
OsuGameBase_Importing.cs Move import logic out to partial class 2021-05-28 02:44:44 +09:00
OsuGameBase.cs Merge pull request #16890 from peppy/beatmap-decoder-ruleset-store 2022-02-25 19:03:43 +09:00
PerformFromMenuRunner.cs Add flow to allow MatchSubScreen to handle beatmap presentation locally 2021-03-03 14:13:51 +09:00