From ff64b66f79f850cc949c7fc01f14beb4b47720a8 Mon Sep 17 00:00:00 2001 From: rustmailer Date: Tue, 19 May 2026 12:12:37 +0800 Subject: [PATCH] fix: Migration to v1.0 panics with index out of bounds: the len is 0 but the index is 0 #234 --- crates/core/src/migrate/store.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/core/src/migrate/store.rs b/crates/core/src/migrate/store.rs index ec68759..9afd261 100644 --- a/crates/core/src/migrate/store.rs +++ b/crates/core/src/migrate/store.rs @@ -259,6 +259,12 @@ impl NewIndexWriter { .parse(eml_bytes) .ok_or_else(|| raise_error!("failed to parse eml".into(), ErrorCode::InternalError))?; + if message.parts.is_empty() { + return Err(raise_error!( + "Malformed or completely empty EML (no parts found)".into(), + ErrorCode::InternalError + )); + } // ── text / preview ──────────────────────────────────────────────── let text = message .body_text(0)