mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Fix awaiting null tasks, closes #128
This commit is contained in:
@@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
using SteamKit2;
|
using SteamKit2;
|
||||||
using SteamKit2.Internal;
|
using SteamKit2.Internal;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ArchiSteamFarm {
|
namespace ArchiSteamFarm {
|
||||||
internal sealed class ArchiHandler : ClientMsgHandler {
|
internal sealed class ArchiHandler : ClientMsgHandler {
|
||||||
@@ -216,7 +218,7 @@ namespace ArchiSteamFarm {
|
|||||||
Client.Send(request);
|
Client.Send(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal AsyncJob<PurchaseResponseCallback> RedeemKey(string key) {
|
internal async Task<PurchaseResponseCallback> RedeemKey(string key) {
|
||||||
if (string.IsNullOrEmpty(key) || !Client.IsConnected) {
|
if (string.IsNullOrEmpty(key) || !Client.IsConnected) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -228,7 +230,12 @@ namespace ArchiSteamFarm {
|
|||||||
request.Body.key = key;
|
request.Body.key = key;
|
||||||
|
|
||||||
Client.Send(request);
|
Client.Send(request);
|
||||||
return new AsyncJob<PurchaseResponseCallback>(Client, request.SourceJobID);
|
try {
|
||||||
|
return await new AsyncJob<PurchaseResponseCallback>(Client, request.SourceJobID);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logging.LogGenericException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
ArchiHandler.PurchaseResponseCallback result;
|
ArchiHandler.PurchaseResponseCallback result;
|
||||||
try {
|
try {
|
||||||
result = await currentBot.ArchiHandler.RedeemKey(key);
|
result = await currentBot.ArchiHandler.RedeemKey(key).ConfigureAwait(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logging.LogGenericException(e, currentBot.BotName);
|
Logging.LogGenericException(e, currentBot.BotName);
|
||||||
break;
|
break;
|
||||||
@@ -575,7 +575,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
ArchiHandler.PurchaseResponseCallback otherResult;
|
ArchiHandler.PurchaseResponseCallback otherResult;
|
||||||
try {
|
try {
|
||||||
otherResult = await bot.ArchiHandler.RedeemKey(key);
|
otherResult = await bot.ArchiHandler.RedeemKey(key).ConfigureAwait(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logging.LogGenericException(e, bot.BotName);
|
Logging.LogGenericException(e, bot.BotName);
|
||||||
break; // We're done with this key
|
break; // We're done with this key
|
||||||
|
|||||||
Reference in New Issue
Block a user