Fix parsing tags in GetActiveTradeOffers (#2060)

* Fix parsing tags in GetActiveTradeOffers

* Accept empty values in Tag constructor

* Throw on null value in constructor

* Fix mindless copypaste
This commit is contained in:
Vitaliy
2020-11-21 17:42:19 +03:00
committed by GitHub
parent 6a8a3b9c8a
commit 3ac04c6aaf
2 changed files with 3 additions and 2 deletions

View File

@@ -1527,7 +1527,8 @@ namespace ArchiSteamFarm {
string? value = tag["internal_name"].AsString();
if (string.IsNullOrEmpty(value)) {
// Apparently, name can be empty, but not null
if (value == null) {
Bot.ArchiLogger.LogNullError(nameof(value));
return null;

View File

@@ -261,7 +261,7 @@ namespace ArchiSteamFarm.Json {
internal Tag(string identifier, string value) {
Identifier = !string.IsNullOrEmpty(identifier) ? identifier : throw new ArgumentNullException(nameof(identifier));
Value = !string.IsNullOrEmpty(value) ? value : throw new ArgumentNullException(nameof(value));
Value = value ?? throw new ArgumentNullException(nameof(value));
}
[JsonConstructor]