mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Fix crash on invalid CustomGamePlayedWhileFarming
This commit is contained in:
@@ -435,6 +435,15 @@ public sealed class BotConfig {
|
||||
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(BotBehaviour), BotBehaviour));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(CustomGamePlayedWhileFarming)) {
|
||||
try {
|
||||
// Test CustomGamePlayedWhileFarming against supported format, otherwise we'll throw later when used
|
||||
string _ = string.Format(CultureInfo.CurrentCulture, CustomGamePlayedWhileFarming);
|
||||
} catch (FormatException e) {
|
||||
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(CustomGamePlayedWhileFarming), e.Message));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (EFarmingOrder farmingOrder in FarmingOrders.Where(static farmingOrder => !Enum.IsDefined(farmingOrder))) {
|
||||
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(FarmingOrders), farmingOrder));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user