Replacing the try-catch block with null-conditional and null-coalescing operators
This commit is contained in:
parent
66b1d59c66
commit
c2905744b0
1 changed files with 2 additions and 12 deletions
|
@ -173,18 +173,8 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (StrEquals(RomfsDir, modDir.Name))
|
||||
{
|
||||
bool enabled;
|
||||
|
||||
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;
|
||||
}
|
||||
var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
|
||||
var enabled = modData?.Enabled ?? true;
|
||||
|
||||
mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
|
||||
types.Append('R');
|
||||
|
|
Loading…
Add table
Reference in a new issue