mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add null reference checks.
This commit is contained in:
@@ -136,6 +136,9 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
break;
|
||||
}
|
||||
|
||||
if(_assets == null)
|
||||
return;
|
||||
|
||||
_genericHddIcon =
|
||||
new Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png")));
|
||||
|
||||
@@ -150,15 +153,18 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
|
||||
_usbIcon =
|
||||
new
|
||||
Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png")));
|
||||
Bitmap(_assets.Open(new
|
||||
Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media-usb.png")));
|
||||
|
||||
_removableIcon =
|
||||
new Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png")));
|
||||
new
|
||||
Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-removable-media.png")));
|
||||
|
||||
_sdIcon =
|
||||
new Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-flash-sd-mmc.png")));
|
||||
|
||||
_ejectIcon = new Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-eject.png")));
|
||||
_ejectIcon =
|
||||
new Bitmap(_assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/media-eject.png")));
|
||||
}
|
||||
|
||||
public bool DevicesSupported
|
||||
@@ -168,7 +174,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
public bool NativeMenuSupported =>
|
||||
NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as
|
||||
NativeMenu.GetIsNativeMenuExported((Application.Current?.ApplicationLifetime as
|
||||
IClassicDesktopStyleApplicationLifetime)?.MainWindow);
|
||||
|
||||
[NotNull]
|
||||
@@ -480,7 +486,7 @@ public sealed class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
internal void ExecuteExitCommand() =>
|
||||
(Application.Current.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||
(Application.Current?.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||
|
||||
void ExecuteConsoleCommand()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user