mirror of
https://github.com/helix-editor/helix
synced 2024-11-10 10:34:45 +01:00
Fix panic when starting helix tutor (#11352)
Closes #11351 Also fixed some minor issues related to log message contents, and removed unnecessary use of `.as_mut()` as per code review comments on the PR.
This commit is contained in:
parent
fade4b218c
commit
f5950196d9
@ -1080,22 +1080,25 @@ impl Document {
|
||||
}
|
||||
|
||||
pub fn pickup_last_saved_time(&mut self) {
|
||||
self.last_saved_time = match self.path.as_mut().unwrap().metadata() {
|
||||
Ok(metadata) => match metadata.modified() {
|
||||
Ok(mtime) => mtime,
|
||||
Err(_) => {
|
||||
self.last_saved_time = match self.path().as_mut() {
|
||||
Some(path) => match path.metadata() {
|
||||
Ok(metadata) => match metadata.modified() {
|
||||
Ok(mtime) => mtime,
|
||||
Err(_) => {
|
||||
log::error!(
|
||||
"Use a system time instead of fs' mtime not supported on this platform"
|
||||
);
|
||||
SystemTime::now()
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Use a system time instead of fs' mtime not supported on this platform"
|
||||
"Use a system time instead of fs' mtime: failed to file's metadata: {e}"
|
||||
);
|
||||
SystemTime::now()
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Use a system time instead of fs' mtime: failed to file's metadata: {e}"
|
||||
);
|
||||
SystemTime::now()
|
||||
}
|
||||
None => SystemTime::now(),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user