Skip to content

Commit 6e38c00

Browse files
authored
fix(cast): send should not panic on revert decoding (#10155)
1 parent c9bc31e commit 6e38c00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/cast/src/tx.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ where
460460
/// Helper function that tries to decode custom error name and inputs from error payload data.
461461
async fn decode_execution_revert(data: &RawValue) -> Result<Option<String>> {
462462
if let Some(err_data) = serde_json::from_str::<String>(data.get())?.strip_prefix("0x") {
463-
let selector = err_data.get(..8).unwrap();
463+
let Some(selector) = err_data.get(..8) else { return Ok(None) };
464+
464465
if let Some(known_error) = SignaturesIdentifier::new(Config::foundry_cache_dir(), false)?
465466
.write()
466467
.await

0 commit comments

Comments
 (0)