mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-18 12:55:54 +01:00
Try and fix nullref
This commit is contained in:
parent
290a6ad5de
commit
4ffb8aef12
@ -1082,8 +1082,7 @@ namespace Ryujinx.UI.App.Common
|
|||||||
var currentlySelected = TitleUpdates.Items.FindFirst(it =>
|
var currentlySelected = TitleUpdates.Items.FindFirst(it =>
|
||||||
it.TitleUpdate.TitleIdBase == update.TitleIdBase && it.IsSelected);
|
it.TitleUpdate.TitleIdBase == update.TitleIdBase && it.IsSelected);
|
||||||
|
|
||||||
var shouldSelect = !currentlySelected.HasValue ||
|
var shouldSelect = currentlySelected.Check(curr => curr.TitleUpdate.Version < update.Version);
|
||||||
currentlySelected.Value.TitleUpdate.Version < update.Version;
|
|
||||||
|
|
||||||
_titleUpdates.AddOrUpdate((update, shouldSelect));
|
_titleUpdates.AddOrUpdate((update, shouldSelect));
|
||||||
|
|
||||||
@ -1478,7 +1477,7 @@ namespace Ryujinx.UI.App.Common
|
|||||||
|
|
||||||
if (TryGetTitleUpdatesFromFile(application.Path, out var bundledUpdates))
|
if (TryGetTitleUpdatesFromFile(application.Path, out var bundledUpdates))
|
||||||
{
|
{
|
||||||
var savedUpdateLookup = savedUpdates.Select(update => update.Item1).ToHashSet();
|
var savedUpdateLookup = savedUpdates.Select(update => update.Update).ToHashSet();
|
||||||
bool updatesChanged = false;
|
bool updatesChanged = false;
|
||||||
|
|
||||||
foreach (var update in bundledUpdates.OrderByDescending(bundled => bundled.Version))
|
foreach (var update in bundledUpdates.OrderByDescending(bundled => bundled.Version))
|
||||||
@ -1486,11 +1485,10 @@ namespace Ryujinx.UI.App.Common
|
|||||||
if (!savedUpdateLookup.Contains(update))
|
if (!savedUpdateLookup.Contains(update))
|
||||||
{
|
{
|
||||||
bool shouldSelect = false;
|
bool shouldSelect = false;
|
||||||
if (!selectedUpdate.HasValue || selectedUpdate.Value.Item1.Version < update.Version)
|
if (selectedUpdate.Check(su => su.Update.Version < update.Version))
|
||||||
{
|
{
|
||||||
shouldSelect = true;
|
shouldSelect = true;
|
||||||
if (selectedUpdate)
|
_titleUpdates.AddOrUpdate((selectedUpdate.Value.Update, false));
|
||||||
_titleUpdates.AddOrUpdate((selectedUpdate.Value.Item1, false));
|
|
||||||
selectedUpdate = (update, true);
|
selectedUpdate = (update, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace Ryujinx.UI.Common.Helper
|
|||||||
{
|
{
|
||||||
private static readonly TitleUpdateMetadataJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
private static readonly TitleUpdateMetadataJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||||
|
|
||||||
public static List<(TitleUpdateModel, bool IsSelected)> LoadTitleUpdatesJson(VirtualFileSystem vfs, ulong applicationIdBase)
|
public static List<(TitleUpdateModel Update, bool IsSelected)> LoadTitleUpdatesJson(VirtualFileSystem vfs, ulong applicationIdBase)
|
||||||
{
|
{
|
||||||
var titleUpdatesJsonPath = PathToGameUpdatesJson(applicationIdBase);
|
var titleUpdatesJsonPath = PathToGameUpdatesJson(applicationIdBase);
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ namespace Ryujinx.UI.Common.Helper
|
|||||||
JsonHelper.SerializeToFile(titleUpdatesJsonPath, titleUpdateWindowData, _serializerContext.TitleUpdateMetadata);
|
JsonHelper.SerializeToFile(titleUpdatesJsonPath, titleUpdateWindowData, _serializerContext.TitleUpdateMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<(TitleUpdateModel, bool IsSelected)> LoadTitleUpdates(VirtualFileSystem vfs, TitleUpdateMetadata titleUpdateMetadata, ulong applicationIdBase)
|
private static List<(TitleUpdateModel Update, bool IsSelected)> LoadTitleUpdates(VirtualFileSystem vfs, TitleUpdateMetadata titleUpdateMetadata, ulong applicationIdBase)
|
||||||
{
|
{
|
||||||
var result = new List<(TitleUpdateModel, bool IsSelected)>();
|
var result = new List<(TitleUpdateModel, bool IsSelected)>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user