branch: elpa/hyperdrive
commit c7b46aaebff5e2d055f1b2621d6b7c091b951fe3
Author: Joseph Turner <jos...@ushin.org>
Commit: Joseph Turner <jos...@ushin.org>

    Fix: (h//gateway-cleanup-default) Check buffer-live-p before killing
    
    This hook can now be run twice without error.
---
 hyperdrive-lib.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index c392464ef6..58bc429061 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1576,7 +1576,10 @@ Or if gateway isn't dead within timeout, show an error."
 (defun h//gateway-cleanup-default ()
   "Clean up gateway process buffers, etc.
 To be called after gateway process dies."
-  (kill-buffer (process-buffer h/gateway-process))
+  (when-let* ((process h/gateway-process)
+              (buffer (process-buffer h/gateway-process))
+              ((buffer-live-p buffer)))
+    (kill-buffer (process-buffer h/gateway-process)))
   (setf h/gateway-process nil))
 
 (defun h/gateway-live-p ()

Reply via email to