Fixes nullref in marketplace config extension

This commit is contained in:
ThatBen 2025-06-06 08:23:35 +02:00
parent b7781a6eae
commit aa4576c97d
No known key found for this signature in database
GPG Key ID: 62C543548433D43E

View File

@ -96,8 +96,23 @@ namespace CodexContractsPlugin.Marketplace
public partial class MarketplaceConfig : IMarketplaceConfigInput
{
public int MaxNumberOfSlashes => this.Collateral.MaxNumberOfSlashes;
public TimeSpan PeriodDuration => TimeSpan.FromSeconds(this.Proofs.Period);
public int MaxNumberOfSlashes
{
get
{
if (Collateral == null) return -1;
return Collateral.MaxNumberOfSlashes;
}
}
public TimeSpan PeriodDuration
{
get
{
if (Proofs == null) return TimeSpan.MinValue;
return TimeSpan.FromSeconds(this.Proofs.Period);
}
}
}
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.