From f5f431458c3cfe98f8c92e0855e2c1f8ee2996af Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sun, 19 Oct 2025 02:25:55 -0700 Subject: [PATCH] instead of a panic, fail with a specific error if there is no entry to boot --- README.md | 2 +- src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0ef3150..8537ce2 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Sprout is licensed under Apache 2.0 and is open to modifications and contributio ## Features NOTE: Currently, Sprout is experimental and is not intended for production use. For example, it doesn't currently -have secure boot support. In fact, as of writing, it doesn't even have a boot menu. Instead, it boots the first entry it sees, or panics. +have secure boot support. In fact, as of writing, it doesn't even have a boot menu. Instead, it boots the first entry it sees, or fails. ### Current diff --git a/src/main.rs b/src/main.rs index 599b2d4..5992177 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,9 +96,9 @@ fn main() -> Result<()> { phase(context.clone(), &config.phases.late).context("unable to execute late phase")?; - let index = 1; - - let (context, entry) = &final_entries[index - 1]; + let Some((context, entry)) = final_entries.first() else { + bail!("no entries found"); + }; for action in &entry.actions { let action = context.stamp(action);