Skip to content

Commit 2672873

Browse files
committed
Catched what caused the null exception in the console.
1 parent 7317c10 commit 2672873

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

RageBlock/Program.cs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
namespace RageBlock
22
{
3+
using LeagueSharp;
4+
using LeagueSharp.Common;
35
using System;
46
using System.Collections.Generic;
57
using System.Linq;
68
using System.Text.RegularExpressions;
7-
using LeagueSharp;
8-
using LeagueSharp.Common;
99

1010
internal class Program
1111
{
@@ -17,7 +17,7 @@ internal class Program
1717

1818
private static List<string> Muted = new List<string>();
1919

20-
#endregion
20+
#endregion Constants & Static Fields
2121

2222
#region Methods
2323

@@ -47,27 +47,33 @@ private static void Game_OnChat(GameChatEventArgs args)
4747
}
4848
var regex = new Regex(@"\b" + string.Join(@"\b|\b", Rage.Flame) + @"\b", RegexOptions.IgnoreCase);
4949
var match = regex.Match(args.Message);
50-
if (args.Sender.IsMe)
50+
if (args.Sender == null)
5151
{
5252
return;
5353
}
54+
if (args.Sender.IsMe)
55+
{
56+
return;
57+
}
5458
if (Muted.Any(args.Sender.Name.Contains))
5559
{
5660
return;
57-
}
58-
if (!match.Success)
61+
}
62+
if (!match.Success)
5963
{
6064
return;
61-
}
65+
}
66+
var senderName = new List<string> { args.Sender.Name };
6267
args.Process = false;
6368
if (m.Item("Block").GetValue<StringList>().SelectedIndex != 0)
6469
{
6570
return;
66-
}
67-
Muted.Add(args.Sender.Name);
71+
}
72+
Muted.Add(senderName.ToString());
6873
Utility.DelayAction.Add(new Random().Next(127, 723), () =>
69-
Game.Say("/mute " + args.Sender.Name)
74+
Game.Say("/mute " + senderName)
7075
);
76+
senderName.Remove(senderName.ToString());
7177
}
7278

7379
private static void Game_OnInput(GameInputEventArgs args)
@@ -126,6 +132,6 @@ private static void Log(object value)
126132
Game.PrintChat("[" + DateTime.Now.ToString("HH:mm") + "] <font color='#eb7577'>" + R + "</font>: " + value);
127133
}
128134

129-
#endregion
135+
#endregion Methods
130136
}
131137
}

RageBlock/Rage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ public static class Rage
66

77
public static string[] Flame = new string[]
88
{
9-
/*
10-
Chinese
9+
/*
10+
Chinese
1111
*/
1212
"13点", "三级片", "下三烂", "下贱", "个老子的", "九游", "乳", "乳交", "乳头", "乳房",
1313
"乳波臀浪", "交配", "仆街", "他奶奶", "他奶奶的", "他奶娘的", "他妈", "他妈ㄉ王八蛋", "他妈地",
@@ -832,6 +832,6 @@ public static class Rage
832832
"Tristana is disappointed that it's never a rocket in your pocket."
833833
};
834834

835-
#endregion
835+
#endregion Static Fields
836836
}
837837
}

0 commit comments

Comments
 (0)