From 872151d2f7c46326ca653cb962c0038f8aa5441e Mon Sep 17 00:00:00 2001 From: JustArchi Date: Tue, 7 Feb 2017 13:09:41 +0100 Subject: [PATCH] Misc --- ArchiSteamFarm/CardsFarmer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index e82b80cef..9e49185cc 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -370,9 +370,9 @@ namespace ArchiSteamFarm { ushort cardsRemaining = 0; Match progressMatch = Regex.Match(progressText, @"\d+"); - // This might fail if we have no card drops remaining, that's fine + // This might fail if we have no card drops remaining, 0 is not printed in this case - that's fine if (progressMatch.Success) { - if (!ushort.TryParse(progressMatch.Value, out cardsRemaining)) { + if (!ushort.TryParse(progressMatch.Value, out cardsRemaining) || (cardsRemaining == 0)) { Bot.ArchiLogger.LogNullError(nameof(cardsRemaining)); continue; } @@ -435,12 +435,12 @@ namespace ArchiSteamFarm { continue; } - float hours = 0; + float hours = 0.0F; Match hoursMatch = Regex.Match(hoursString, @"[0-9\.,]+"); - // This might fail if we have exactly 0.0 hours played, that's fine + // This might fail if we have exactly 0.0 hours played, as it's not printed in that case - that's fine if (hoursMatch.Success) { - if (!float.TryParse(hoursMatch.Value, NumberStyles.Number, CultureInfo.InvariantCulture, out hours)) { + if (!float.TryParse(hoursMatch.Value, NumberStyles.Number, CultureInfo.InvariantCulture, out hours) || (hours <= 0.0F)) { Bot.ArchiLogger.LogNullError(nameof(hours)); continue; }