Skip to content

Commit 99516e9

Browse files
authored
don't panic ig entries doesn't exist (#77)
1 parent 2cac48c commit 99516e9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

escrow/contracts/Escrow.cdc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ access(all) contract Escrow {
7777
// Withdraws an NFT entry from the leaderboard.
7878
access(contract) fun transferNftToCollection(nftID: UInt64, depositCap: Capability<&{NonFungibleToken.Collection}>) {
7979
pre {
80-
self.entriesData[nftID] != nil : "Entry does not exist with this NFT ID"
8180
depositCap.address == self.entriesData[nftID]!.ownerAddress : "Only the owner of the entry can withdraw it"
8281
depositCap.check() : "Deposit capability is not valid"
8382
}
83+
if(self.entriesData[nftID] == nil) {
84+
return
85+
}
8486

8587
// Remove the NFT entry's data from the leaderboard.
8688
self.entriesData.remove(key: nftID)!
@@ -97,8 +99,8 @@ access(all) contract Escrow {
9799

98100
// Burns an NFT entry from the leaderboard.
99101
access(contract) fun burn(nftID: UInt64) {
100-
pre {
101-
self.entriesData[nftID] != nil : "Entry does not exist with this NFT ID"
102+
if(self.entriesData[nftID] == nil) {
103+
return
102104
}
103105

104106
// Remove the NFT entry's data from the leaderboard.

0 commit comments

Comments
 (0)