diff --git a/src/file.cc b/src/file.cc index 64373095..9c5f23ab 100644 --- a/src/file.cc +++ b/src/file.cc @@ -148,6 +148,7 @@ StringView homedir() bool fd_readable(int fd) { + kak_assert(fd >= 0); fd_set rfds; FD_ZERO(&rfds); FD_SET(fd, &rfds); @@ -158,6 +159,7 @@ bool fd_readable(int fd) bool fd_writable(int fd) { + kak_assert(fd >= 0); fd_set wfds; FD_ZERO(&wfds); FD_SET(fd, &wfds); diff --git a/src/remote.cc b/src/remote.cc index 5490a7b6..be793f0b 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -439,7 +439,8 @@ RemoteUI::~RemoteUI() // Try to send the remaining data if possible, as it might contain the desired exit status try { - send_data(m_socket_watcher.fd(), m_send_buffer); + if (m_socket_watcher.fd() != -1) + send_data(m_socket_watcher.fd(), m_send_buffer); } catch (disconnected&) {