Skip to content

Commit

Permalink
fixup! Fixes #15209: Control runlog consistency before inserting it
Browse files Browse the repository at this point in the history
Fixes #15209: Control runlog consistency before inserting it
  • Loading branch information
amousset committed Jul 12, 2019
1 parent fd348d0 commit 00ef728
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion relay/sources/relayd/src/data/runlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ impl Display for RunLog {
impl RunLog {
/// Mainly used for testing
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error> {
let info = RunInfo::from_str(path.as_ref().file_name().unwrap().to_str().unwrap())?;
let info = RunInfo::from_str(
path.as_ref()
.file_name()
.and_then(|r| r.to_str())
.ok_or_else(|| {
Error::InvalidRunInfo(path.as_ref().to_str().unwrap_or("").to_string())
})?,
)?;
RunLog::try_from((info, read_to_string(path)?.as_ref()))
}
}
Expand Down

0 comments on commit 00ef728

Please sign in to comment.