Fix panic by checking if CStore
has the crate data we want before actually querying it
This commit is contained in:
parent
987c73158e
commit
beb2f364cc
2 changed files with 18 additions and 6 deletions
|
@ -133,6 +133,10 @@ impl CStore {
|
|||
CrateNum::new(self.metas.len() - 1)
|
||||
}
|
||||
|
||||
pub fn has_crate_data(&self, cnum: CrateNum) -> bool {
|
||||
self.metas[cnum].is_some()
|
||||
}
|
||||
|
||||
pub(crate) fn get_crate_data(&self, cnum: CrateNum) -> CrateMetadataRef<'_> {
|
||||
let cdata = self.metas[cnum]
|
||||
.as_ref()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue