Fix panic when x.py is called without any arguments.

This commit is contained in:
kennytm
2018-02-16 14:27:45 +08:00
parent 366a65665a
commit c788433b15

View File

@@ -385,9 +385,11 @@ impl<'a> Builder<'a> {
Subcommand::Clean { .. } => panic!(),
};
if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
if let Some(path) = paths.get(0) {
if path == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
return;
}
}
let builder = Builder {
build,