difftreelog
fix remove possible panics
in: master
2 files changed
pallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth154 )))154 )))155 })155 })156 // FIXME: it may fail with DispatchError in case of depth limit156 // FIXME: it may fail with DispatchError in case of depth limit157 .map_err(|e| panic!("err?!")).ok()??;157 .ok()??;158 Some(sponsor.as_sub().clone())158 Some(sponsor.as_sub().clone())159 }159 }160 _ => None,160 _ => None,pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -444,7 +444,7 @@
for (id, token_uri) in tokens {
let id: u32 = id.try_into().map_err(|_| "token id overflow")?;
if id != expected_index {
- panic!("item id should be next ({}) but got {}", expected_index, id);
+ return Err("item id should be next".into());
}
expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;