diff --git a/Core/RuntimeObject/Download/Basics.cs b/Core/RuntimeObject/Download/Basics.cs index 36dbfbed..a7edee4f 100644 --- a/Core/RuntimeObject/Download/Basics.cs +++ b/Core/RuntimeObject/Download/Basics.cs @@ -421,7 +421,7 @@ public static void LiveChatListener_MessageReceived(object? sender, Core.LiveCha case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; } @@ -492,7 +492,7 @@ public static void LiveChatListener_MessageReceived(object? sender, Core.LiveCha case SendGiftEventArgs sendGiftEventArgs: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(sendGiftEventArgs.GiftName.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && sendGiftEventArgs.GiftName.Contains(word))) { return; } diff --git a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs index 7c567c69..fb440405 100644 --- a/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs +++ b/Desktop/Views/Windows/DanmaOnlyWindow.xaml.cs @@ -73,7 +73,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; } @@ -98,7 +98,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case SendGiftEventArgs sendGiftEventArgs: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(sendGiftEventArgs.GiftName.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && sendGiftEventArgs.GiftName.Contains(word))) { return; } diff --git a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs index b491fa2e..731cf960 100644 --- a/Desktop/Views/Windows/VlcPlayWindow.xaml.cs +++ b/Desktop/Views/Windows/VlcPlayWindow.xaml.cs @@ -252,7 +252,7 @@ private void LiveChatListener_MessageReceived(object? sender, Core.LiveChat.Mess case DanmuMessageEventArgs Danmu: { string[] BlockWords = Core.Config.Core_RunConfig._BlockBarrageList.Split('|'); - if (BlockWords.Any(Danmu.Message.Contains)) + if (BlockWords.Any(word => !string.IsNullOrEmpty(word) && Danmu.Message.Contains(word))) { return; }