Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 0585e7a

Browse files
committed
More specific exception handling.
Use LINQ to make these loops cleaner.
1 parent 7936050 commit 0585e7a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

EssentialsPlugin/ProcessHandlers/ProcessCleanup.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.Linq;
56
using EssentialsPlugin.Settings;
67
using EssentialsPlugin.Utility;
78
using Sandbox.ModAPI;
@@ -28,23 +29,17 @@ public override void Handle( )
2829
if ( !PluginSettings.Instance.CleanupEnabled )
2930
return;
3031

31-
foreach ( SettingsCleanupTimedItem item in PluginSettings.Instance.CleanupTimedItems )
32+
foreach ( SettingsCleanupTimedItem item in PluginSettings.Instance.CleanupTimedItems.Where( item => item.Enabled ) )
3233
{
33-
if ( !item.Enabled )
34-
continue;
35-
3634
ProcessTimedItem( item );
3735
}
3836

39-
foreach ( SettingsCleanupTriggerItem item in PluginSettings.Instance.CleanupTriggerItems )
37+
foreach ( SettingsCleanupTriggerItem item in PluginSettings.Instance.CleanupTriggerItems.Where( item => item.Enabled ) )
4038
{
41-
if ( !item.Enabled )
42-
continue;
43-
4439
ProcessTriggerItem( item );
4540
}
4641
}
47-
catch ( Exception ex )
42+
catch ( OverflowException ex )
4843
{
4944
Logging.WriteLineAndConsole( string.Format( "ProcessCleanup.Handle(): {0}", ex ) );
5045
}

0 commit comments

Comments
 (0)