branch: elpa/flycheck
commit 8761a7528283f13ac53629cd9bfbdba006de3260
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Guard line-prefix preservation against killed buffers
The get-text-property call in flycheck--setup-highlighting can fail
with args-out-of-range when the overlay's buffer has been killed
(e.g. during async checker completion). Check buffer-live-p first.
---
flycheck.el | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/flycheck.el b/flycheck.el
index 64b4725297..ee537287bd 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -4832,10 +4832,11 @@ function resolves `conditional' style specifications."
level flycheck-indication-mode t))
;; Preserve any existing line-prefix text property (e.g. from
;; org-indent-mode) so the overlay doesn't clobber indentation.
- (let ((existing-prefix (get-text-property
- (overlay-start overlay) 'line-prefix)))
- (when existing-prefix
- (setf (overlay-get overlay 'line-prefix) existing-prefix))))
+ (when (buffer-live-p (overlay-buffer overlay))
+ (let ((existing-prefix (get-text-property
+ (overlay-start overlay) 'line-prefix)))
+ (when existing-prefix
+ (setf (overlay-get overlay 'line-prefix) existing-prefix)))))
(pcase (flycheck--highlighting-style err)
((or `nil (guard (null flycheck-highlighting-mode)))
;; Erase the highlighting