prevent a crash if the new property DerivationStrategies is notset at invoice level

This commit is contained in:
nicolas.dorier 2018-02-19 02:56:44 +09:00
parent aa4519ac30
commit 29aed99fd1

View File

@ -172,16 +172,18 @@ namespace BTCPayServer.Services.Invoices
public DerivationStrategyBase GetDerivationStrategy(BTCPayNetwork network)
{
#pragma warning disable CS0618
JObject strategies = JObject.Parse(DerivationStrategies);
#pragma warning restore CS0618
foreach (var strat in strategies.Properties())
if (!string.IsNullOrEmpty(DerivationStrategies))
{
if (strat.Name == network.CryptoCode)
JObject strategies = JObject.Parse(DerivationStrategies);
#pragma warning restore CS0618
foreach (var strat in strategies.Properties())
{
return BTCPayServer.DerivationStrategy.Parse(strat.Value.Value<string>(), network).DerivationStrategyBase;
if (strat.Name == network.CryptoCode)
{
return BTCPayServer.DerivationStrategy.Parse(strat.Value.Value<string>(), network).DerivationStrategyBase;
}
}
}
#pragma warning disable CS0618
if (network.IsBTC && !string.IsNullOrEmpty(DerivationStrategy))
{