mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix possible null assignment to non-nullable entities.
This commit is contained in:
@@ -190,9 +190,15 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _devicesSupported, value);
|
||||
}
|
||||
|
||||
public bool NativeMenuSupported =>
|
||||
NativeMenu.GetIsNativeMenuExported((Application.Current?.ApplicationLifetime as
|
||||
IClassicDesktopStyleApplicationLifetime)?.MainWindow);
|
||||
public bool NativeMenuSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
Window mainWindow = (Application.Current?.ApplicationLifetime as
|
||||
IClassicDesktopStyleApplicationLifetime)?.MainWindow;
|
||||
return mainWindow is not null && NativeMenu.GetIsNativeMenuExported(mainWindow);
|
||||
}
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
public string Greeting => UI.Welcome_to_Aaru;
|
||||
|
||||
@@ -571,6 +571,11 @@ public sealed partial class Udif
|
||||
}
|
||||
|
||||
buffer = new byte[SECTOR_SIZE];
|
||||
|
||||
// Shall not happen
|
||||
if(data is null)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
Array.Copy(data, relOff, buffer, 0, SECTOR_SIZE);
|
||||
|
||||
if(_sectorCache.Count >= MAX_CACHED_SECTORS)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -54,7 +55,7 @@ sealed class ArchiveInfoCommand : Command
|
||||
Name = "archive-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -45,7 +46,7 @@ namespace Aaru.Commands.Database;
|
||||
sealed class StatisticsCommand : Command
|
||||
{
|
||||
public StatisticsCommand() : base("stats", UI.Database_Stats_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool debug, bool verbose)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ sealed class DeviceReportCommand : Command
|
||||
|
||||
Add(new Option<bool>(new[] { "--trap-disc", "-t" }, () => false, UI.Device_report_using_trap_disc));
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string devicePath, bool trapDisc)
|
||||
|
||||
@@ -77,7 +77,7 @@ sealed class DeviceInfoCommand : Command
|
||||
Name = "device-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string devicePath, string outputPrefix)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
@@ -56,7 +57,7 @@ sealed class ListDevicesCommand : Command
|
||||
Name = "aaru-remote-host"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, [CanBeNull] string aaruRemoteHost)
|
||||
|
||||
@@ -80,7 +80,7 @@ sealed class ExtractFilesCommand : Command
|
||||
Name = "output-dir"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, bool xattrs, string imagePath,
|
||||
|
||||
@@ -72,7 +72,7 @@ sealed class LsCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, string imagePath, bool longFormat,
|
||||
|
||||
@@ -50,7 +50,7 @@ sealed class ListOptionsCommand : Command
|
||||
const string MODULE_NAME = "List-Options command";
|
||||
|
||||
public ListOptionsCommand() : base("options", UI.Filesystem_Options_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool debug, bool verbose)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ sealed class FormatsCommand : Command
|
||||
const string MODULE_NAME = "Formats command";
|
||||
|
||||
public FormatsCommand() : base("formats", UI.List_Formats_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool verbose, bool debug)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ sealed class ChecksumCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, bool adler32, bool crc16, bool crc32, bool crc64,
|
||||
|
||||
@@ -71,7 +71,7 @@ sealed class CompareCommand : Command
|
||||
Name = "image-path2"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath1, string imagePath2)
|
||||
|
||||
@@ -138,7 +138,7 @@ sealed class ConvertImageCommand : Command
|
||||
Name = "output-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool verbose, bool debug, string cicmXml, string comments, int count, string creator,
|
||||
|
||||
@@ -72,7 +72,7 @@ sealed class CreateSidecarCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, uint blockSize, [CanBeNull] string encodingName,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Globalization;
|
||||
@@ -68,7 +69,7 @@ sealed class DecodeCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool verbose, bool debug, bool diskTags, string imagePath, string length, bool sectorTags,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using Aaru.CommonTypes;
|
||||
@@ -65,7 +66,7 @@ sealed class EntropyCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, bool duplicatedSectors, string imagePath, bool separatedTracks,
|
||||
|
||||
@@ -56,7 +56,7 @@ sealed class ImageInfoCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath)
|
||||
|
||||
@@ -50,7 +50,7 @@ sealed class ListOptionsCommand : Command
|
||||
const string MODULE_NAME = "List-Options command";
|
||||
|
||||
public ListOptionsCommand() : base("options", UI.Image_Options_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool debug, bool verbose)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ sealed class PrintHexCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, ulong length, bool longSectors, ulong start,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
@@ -70,7 +71,7 @@ sealed class VerifyCommand : Command
|
||||
Name = "image-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, bool verifyDisc, bool verifySectors,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
@@ -47,7 +48,7 @@ sealed class ListEncodingsCommand : Command
|
||||
const string MODULE_NAME = "List-Encodings command";
|
||||
|
||||
public ListEncodingsCommand() : base("list-encodings", UI.List_Encodings_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool debug, bool verbose)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ sealed class ListNamespacesCommand : Command
|
||||
const string MODULE_NAME = "List-Namespaces command";
|
||||
|
||||
public ListNamespacesCommand() : base("list-namespaces", UI.List_Namespaces_Command_Description) =>
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
|
||||
public static int Invoke(bool debug, bool verbose)
|
||||
{
|
||||
|
||||
@@ -156,7 +156,7 @@ sealed class DumpMediaCommand : Command
|
||||
Add(new Option<string>(new[] { "--aaru-metadata", "-m" }, () => null,
|
||||
"Take metadata from existing Aaru Metadata sidecar."));
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string cicmXml, string devicePath, bool resume, string encoding,
|
||||
|
||||
@@ -78,7 +78,7 @@ sealed class MediaInfoCommand : Command
|
||||
Name = "device-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string devicePath, string outputPrefix)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -66,7 +67,7 @@ sealed class MediaScanCommand : Command
|
||||
Name = "device-path"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string devicePath, string ibgLog, string mhddLog,
|
||||
|
||||
@@ -57,7 +57,7 @@ sealed class RemoteCommand : Command
|
||||
Name = "host"
|
||||
});
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)) ?? throw new NullReferenceException());
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string host)
|
||||
|
||||
Reference in New Issue
Block a user