aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-10-04 06:19:37 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-10-04 06:19:37 +0200
commit994cd8561e2e08432fa5dcb4a86ad52b206fe360 (patch)
tree791238c3c2f1c25f2ddee173864fd4ac173e82c1
parent54e3fc561add5ce9d776a11a286b988aacb59daa (diff)
downloadtools.nes-994cd8561e2e08432fa5dcb4a86ad52b206fe360.tar.gz
tools.nes-994cd8561e2e08432fa5dcb4a86ad52b206fe360.zip
readrom: don't panic on badly formatted ROMs
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--crates/readrom/src/main.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/readrom/src/main.rs b/crates/readrom/src/main.rs
index fc124e9..09b394d 100644
--- a/crates/readrom/src/main.rs
+++ b/crates/readrom/src/main.rs
@@ -169,6 +169,11 @@ fn print_header(header: &Header) {
fn print_vectors(addrs: &[u8]) {
println!("Vectors:");
+ if addrs.is_empty() {
+ println!(" Could not retrieve information on this ROM (bad file?)");
+ return;
+ }
+
println!(
" NMI:\t\t\t{:#04x}",
u16::from_le_bytes([addrs[0], addrs[1]])