diff --git a/src/Avalon.Client/HashCommands/Beep.cs b/src/Avalon.Client/HashCommands/Beep.cs index b9e0e5c2..32907652 100644 --- a/src/Avalon.Client/HashCommands/Beep.cs +++ b/src/Avalon.Client/HashCommands/Beep.cs @@ -43,19 +43,19 @@ public override void Execute() switch (o.BeepType) { case BeepType.Beep: - SystemSounds.Beep.Play(); + SystemSounds.Beep?.Play(); return; case BeepType.Asterisk: - SystemSounds.Asterisk.Play(); + SystemSounds.Asterisk?.Play(); return; case BeepType.Exclamation: - SystemSounds.Exclamation.Play(); + SystemSounds.Exclamation?.Play(); return; case BeepType.Hand: - SystemSounds.Hand.Play(); + SystemSounds.Hand?.Play(); return; case BeepType.Question: - SystemSounds.Question.Play(); + SystemSounds.Question?.Play(); return; case BeepType.Alert: // Special type, this will play even if other system sounds are muted. diff --git a/src/Avalon.Client/HashCommands/ToastAlarm.cs b/src/Avalon.Client/HashCommands/ToastAlarm.cs index d9bd5dea..38bb60fb 100644 --- a/src/Avalon.Client/HashCommands/ToastAlarm.cs +++ b/src/Avalon.Client/HashCommands/ToastAlarm.cs @@ -29,7 +29,7 @@ public ToastAlarm(IInterpreter interp) : base(interp) public override void Execute() { - SystemSounds.Exclamation.Play(); + SystemSounds.Exclamation?.Play(); App.Toast.ShowNotification("Avalon", this.Parameters, ToolTipIcon.Warning); } diff --git a/src/Avalon.Client/MainWindow.Network.cs b/src/Avalon.Client/MainWindow.Network.cs index 8c51d3d3..99624f0f 100644 --- a/src/Avalon.Client/MainWindow.Network.cs +++ b/src/Avalon.Client/MainWindow.Network.cs @@ -7,6 +7,7 @@ * @license : MIT */ +using System.Media; using Avalon.Colors; using Avalon.Common.Models; using Avalon.Controls; @@ -139,7 +140,14 @@ public void HandleLineReceived(object sender, string e) // One beep per line max, everything else is ignored. if (App.Settings.ProfileSettings.AnsiBeep && e.Contains('\a')) { - App.Beep?.Play(); + if (App.Beep != null) + { + App.Beep.Play(); + } + else + { + SystemSounds.Beep?.Play(); + } } try