Skip to content

Commit c328c82

Browse files
authored
fix: fix index out of bounds error if block is empty (paradigmxyz#3281)
1 parent e78d2fc commit c328c82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/rpc/rpc/src/eth/api/fees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ where
137137
sorter.sort();
138138

139139
let mut rewards = Vec::with_capacity(reward_percentiles.len());
140-
let mut sum_gas_used = sorter[0].gas_used;
140+
let mut sum_gas_used = sorter.first().map(|tx| tx.gas_used).unwrap_or_default();
141141
let mut tx_index = 0;
142142

143143
for percentile in reward_percentiles.iter() {

0 commit comments

Comments
 (0)