From 2ef880cc75a393ee57c57930d34c9c4b516db4e4 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka <yamaoka@jpl.org> Date: Tue, 8 Aug 2017 23:40:27 +0000 Subject: [PATCH] Don't try to jump to non-existent part (bug#28013) * lisp/gnus/gnus-art.el (gnus-article-edit-part): Don't try to jump to the next part if there is the only one part in the article (bug#28013). --- lisp/gnus/gnus-art.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 3f384c65ece..ce0ff2ee8c0 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -5058,11 +5058,14 @@ and `gnus-mime-delete-part', and not provided at run-time normally." (gnus-article-edit-done)) (gnus-configure-windows 'article) (sit-for 0) - (when (and current-id (integerp gnus-auto-select-part)) - (gnus-article-jump-to-part - (min (max (+ current-id gnus-auto-select-part) 1) - (with-current-buffer gnus-article-buffer - (length gnus-article-mime-handle-alist))))))) + (let ((handles (with-current-buffer gnus-article-buffer + gnus-article-mime-handle-alist))) + ;; `handles' will be nil if there is the only one part + ;; in the article and is deleted. + (when (and handles current-id (integerp gnus-auto-select-part)) + (gnus-article-jump-to-part + (min (max (+ current-id gnus-auto-select-part) 1) + (length handles))))))) (defun gnus-mime-replace-part (file) "Replace MIME part under point with an external body." -- 2.39.5