forked from Mirror/Ryujinx
Replacing the try-catch block with null-conditional and null-coalescing operators (#6612)
* Replacing the try-catch block with null-conditional and null-coalescing operators * repeating
This commit is contained in:
parent
451a28afb8
commit
0b55914864
1 changed files with 4 additions and 24 deletions
|
@ -173,36 +173,16 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
if (StrEquals(RomfsDir, modDir.Name))
|
if (StrEquals(RomfsDir, modDir.Name))
|
||||||
{
|
{
|
||||||
bool enabled;
|
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
||||||
|
var enabled = modData?.Enabled ?? true;
|
||||||
try
|
|
||||||
{
|
|
||||||
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
|
||||||
enabled = modData.Enabled;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Mod is not in the list yet. New mods should be enabled by default.
|
|
||||||
enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||||
types.Append('R');
|
types.Append('R');
|
||||||
}
|
}
|
||||||
else if (StrEquals(ExefsDir, modDir.Name))
|
else if (StrEquals(ExefsDir, modDir.Name))
|
||||||
{
|
{
|
||||||
bool enabled;
|
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
||||||
|
var enabled = modData?.Enabled ?? true;
|
||||||
try
|
|
||||||
{
|
|
||||||
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
|
||||||
enabled = modData.Enabled;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Mod is not in the list yet. New mods should be enabled by default.
|
|
||||||
enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mods.ExefsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
mods.ExefsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||||
types.Append('E');
|
types.Append('E');
|
||||||
|
|
Loading…
Reference in a new issue