]> git.lizzy.rs Git - rust.git/commitdiff
Fix panic when `x.py` is called without any arguments.
authorkennytm <kennytm@gmail.com>
Fri, 16 Feb 2018 06:27:45 +0000 (14:27 +0800)
committerkennytm <kennytm@gmail.com>
Fri, 16 Feb 2018 06:31:25 +0000 (14:31 +0800)
src/bootstrap/builder.rs

index 7345b284dc70aa210089904afa9560eebe0c5346..66a1c97246200d5c68a94817625929bdac17d22a 100644 (file)
@@ -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 {