From c788433b15a81935abcb84e9644d04422bf84a48 Mon Sep 17 00:00:00 2001 From: kennytm Date: Fri, 16 Feb 2018 14:27:45 +0800 Subject: [PATCH] Fix panic when `x.py` is called without any arguments. --- src/bootstrap/builder.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7345b284dc7..66a1c972462 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -385,8 +385,10 @@ pub fn run(build: &Build) { Subcommand::Clean { .. } => panic!(), }; - if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") { - return; + if let Some(path) = paths.get(0) { + if path == Path::new("nonexistent/path/to/trigger/cargo/metadata") { + return; + } } let builder = Builder { -- 2.44.0