mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Fix nullref in case of successfull request but no backgrounds available
This commit is contained in:
parent
0b46c19b23
commit
51a58269ad
@ -32,7 +32,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
request.Success += response =>
|
request.Success += response =>
|
||||||
{
|
{
|
||||||
cachedResponse.Value = response;
|
cachedResponse.Value = response;
|
||||||
current = RNG.Next(0, cachedResponse.Value.Backgrounds.Count);
|
current = RNG.Next(0, response.Backgrounds?.Count ?? 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
api.PerformAsync(request);
|
api.PerformAsync(request);
|
||||||
@ -41,7 +41,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
public SeasonalBackground LoadBackground()
|
public SeasonalBackground LoadBackground()
|
||||||
{
|
{
|
||||||
var backgrounds = cachedResponse.Value.Backgrounds;
|
var backgrounds = cachedResponse.Value.Backgrounds;
|
||||||
if (!backgrounds.Any()) return null;
|
if (backgrounds == null || !backgrounds.Any()) return null;
|
||||||
|
|
||||||
current = (current + 1) % backgrounds.Count;
|
current = (current + 1) % backgrounds.Count;
|
||||||
string url = backgrounds[current].Url;
|
string url = backgrounds[current].Url;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user