Skip to content

Commit 679a19e

Browse files
committed
Fix crash in cleanup command
1 parent 8df1d17 commit 679a19e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Essentials/Commands/CleanupModule.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ public void Delete()
3232
Context.Respond($"Deleted {count} grids matching the given conditions.");
3333
}
3434

35-
private IEnumerable<MyCubeGrid> ScanConditions(List<string> args)
35+
private IEnumerable<MyCubeGrid> ScanConditions(IReadOnlyList<string> args)
3636
{
3737
var conditions = new List<Func<MyCubeGrid, bool>>();
3838

3939
for (var i = 0; i < args.Count; i += 2)
4040
{
41+
if (i + 1 > args.Count)
42+
break;
43+
4144
var arg = args[i];
4245
var parameter = args[i + 1];
4346

Essentials/Essentials.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,9 @@
135135
<Compile Include="AutoCommand.cs" />
136136
<Compile Include="Commands\BlocksModule.cs" />
137137
<Compile Include="Commands\CleanupModule.cs" />
138-
<Compile Include="Commands\ScanModule.cs" />
139138
<Compile Include="Commands\VoxelModule.cs" />
140139
<Compile Include="Commands\WorldModule.cs" />
141140
<Compile Include="EssentialsConfig.cs" />
142-
<Compile Include="Commands\DeleteModule.cs" />
143141
<Compile Include="Commands\EntityModule.cs" />
144142
<Compile Include="EssentialsControl.xaml.cs">
145143
<DependentUpon>EssentialsControl.xaml</DependentUpon>

0 commit comments

Comments
 (0)