fix: wallet panic
This commit is contained in:
parent
e5e6d5cddb
commit
a08552338b
4 changed files with 46 additions and 13 deletions
|
@ -58,7 +58,7 @@ impl DataManager {
|
|||
Ok(res.unwrap())
|
||||
}
|
||||
|
||||
const MAXIMUM_FREE_PRODUCTS: usize = 5;
|
||||
const MAXIMUM_FREE_PRODUCTS: usize = 10;
|
||||
|
||||
/// Create a new product in the database.
|
||||
///
|
||||
|
|
|
@ -54,13 +54,17 @@ impl DataManager {
|
|||
match transfer.method {
|
||||
CoinTransferMethod::Transfer => None,
|
||||
CoinTransferMethod::Purchase(id) => {
|
||||
Some(if let Some(product) = seen_products.get(&id) {
|
||||
product.to_owned()
|
||||
if let Some(product) = seen_products.get(&id) {
|
||||
Some(product.to_owned())
|
||||
} else {
|
||||
let product = self.get_product_by_id(id).await?;
|
||||
seen_products.insert(product.id, product.clone());
|
||||
product
|
||||
})
|
||||
match self.get_product_by_id(id).await {
|
||||
Ok(product) => {
|
||||
seen_products.insert(product.id, product.clone());
|
||||
Some(product)
|
||||
}
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
transfer.is_pending,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue