Fix fatal exception when checking if buffer needs to be reloaded
If, for example, the buffer path now is a directory, MappedFile will throw on construction. Using a try block to explicitely allow errors fixes the issue.
This commit is contained in:
parent
be49f36205
commit
fa060c2a17
|
@ -367,6 +367,8 @@ void Client::check_if_buffer_needs_reloading()
|
|||
if (not (buffer.flags() & Buffer::Flags::File) or reload == Autoreload::No)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
const String& filename = buffer.name();
|
||||
const timespec ts = get_fs_timestamp(filename);
|
||||
const auto status = buffer.fs_status();
|
||||
|
@ -392,6 +394,11 @@ void Client::check_if_buffer_needs_reloading()
|
|||
}
|
||||
else
|
||||
reload_buffer();
|
||||
}
|
||||
catch (Kakoune::runtime_error& error)
|
||||
{
|
||||
write_to_debug_buffer(format("Error while checking if buffer {} changed: {}", buffer.name(), error.what()));
|
||||
}
|
||||
}
|
||||
|
||||
StringView Client::get_env_var(StringView name) const
|
||||
|
|
Loading…
Reference in New Issue
Block a user