From fb2e2f89935240666de66e4b2c11125cb3b2943d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 7 Apr 2020 13:37:32 +0530 Subject: more lint fixes --- src/operations/pending.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/operations/pending.ts') diff --git a/src/operations/pending.ts b/src/operations/pending.ts index cee929aa2..3e548a27f 100644 --- a/src/operations/pending.ts +++ b/src/operations/pending.ts @@ -37,7 +37,7 @@ import { } from "../util/time"; import { TransactionHandle } from "../util/query"; import { InternalWalletState } from "./state"; -import { getBalances, getBalancesInsideTransaction } from "./balance"; +import { getBalancesInsideTransaction } from "./balance"; import { ReserveType } from "../types/history"; function updateRetryDelay( @@ -286,13 +286,23 @@ async function gatherProposalPending( if (onlyDue) { return; } - resp.pendingOperations.push({ - type: PendingOperationType.ProposalChoice, - givesLifeness: false, - merchantBaseUrl: proposal.download!!.contractData.merchantBaseUrl, - proposalId: proposal.proposalId, - proposalTimestamp: proposal.timestamp, - }); + const dl = proposal.download; + if (!dl) { + resp.pendingOperations.push({ + type: PendingOperationType.Bug, + message: "proposal is in invalid state", + details: {}, + givesLifeness: false, + }); + } else { + resp.pendingOperations.push({ + type: PendingOperationType.ProposalChoice, + givesLifeness: false, + merchantBaseUrl: dl.contractData.merchantBaseUrl, + proposalId: proposal.proposalId, + proposalTimestamp: proposal.timestamp, + }); + } } else if (proposal.proposalStatus == ProposalStatus.DOWNLOADING) { resp.nextRetryDelay = updateRetryDelay( resp.nextRetryDelay, -- cgit v1.2.3