Fix crash on changing from empty scratch buffer to itself (#975)

This commit is contained in:
ath3 2021-11-04 09:57:04 +01:00 committed by GitHub
parent 7b65a6d687
commit aa4d0b4646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,6 +240,8 @@ pub fn switch(&mut self, id: DocumentId, action: Action) {
let remove_empty_scratch = !doc.is_modified()
// If the buffer has no path and is not modified, it is an empty scratch buffer.
&& doc.path().is_none()
// If the buffer we are changing to is not this buffer
&& id != doc.id
// Ensure the buffer is not displayed in any other splits.
&& !self
.tree