mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-18 10:37:04 +00:00
misc: chore: Fix possible System.NullReferenceExceptions
This commit is contained in:
parent
19013d360a
commit
3c644a712d
8 changed files with 26 additions and 27 deletions
|
|
@ -93,9 +93,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
_modJsonPath = Path.Combine(AppDataManager.GamesDirPath, applicationId.ToString("x16"), "mods.json");
|
||||
|
||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
_storageProvider = desktop.MainWindow.StorageProvider;
|
||||
_storageProvider = desktop.MainWindow?.StorageProvider;
|
||||
}
|
||||
|
||||
LoadMods(applicationId, _installedDlcIds);
|
||||
|
|
@ -117,8 +117,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
foreach (var mod in modCache.RomfsDirs)
|
||||
{
|
||||
var modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent.FullName))
|
||||
var modModel = new ModModel(mod.Path.Parent?.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent?.FullName))
|
||||
{
|
||||
Mods.Add(modModel);
|
||||
}
|
||||
|
|
@ -131,8 +131,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
foreach (var mod in modCache.ExefsDirs)
|
||||
{
|
||||
var modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent.FullName))
|
||||
var modModel = new ModModel(mod.Path.Parent?.FullName, mod.Name, mod.Enabled, inSd);
|
||||
if (Mods.All(x => x.Path != mod.Path.Parent?.FullName))
|
||||
{
|
||||
Mods.Add(modModel);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue