diff --git a/src/ui.rs b/src/ui.rs index 8ef7b58f..10405f3f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1190,12 +1190,14 @@ where let packet_count = capture.packet_index.len(); let meta = capture.shared.metadata.load_full(); let mut saver = Saver::new(dest, meta)?; - for (result, i) in capture.timestamped_packets()?.zip(0..packet_count) { - let (timestamp_ns, packet) = result?; - saver.add_packet(&packet, timestamp_ns)?; - CURRENT.store(i + 1, Ordering::Relaxed); - if STOP.load(Ordering::Relaxed) { - break; + if packet_count > 0 { + for (result, i) in capture.timestamped_packets()?.zip(0..packet_count) { + let (timestamp_ns, packet) = result?; + saver.add_packet(&packet, timestamp_ns)?; + CURRENT.store(i + 1, Ordering::Relaxed); + if STOP.load(Ordering::Relaxed) { + break; + } } } saver.close()