rustbuild: Less panics in musl_root

Don't panic if the target wasn't configured.
This commit is contained in:
Alex Crichton 2016-10-13 12:01:59 -07:00
parent 9cb01365ee
commit 651bb69ecd
1 changed files with 2 additions and 1 deletions

View File

@ -991,7 +991,8 @@ impl Build {
/// Returns the "musl root" for this `target`, if defined
fn musl_root(&self, target: &str) -> Option<&Path> {
self.config.target_config[target].musl_root.as_ref()
self.config.target_config.get(target)
.and_then(|t| t.musl_root.as_ref())
.or(self.config.musl_root.as_ref())
.map(|p| &**p)
}