Add more protection
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 9 Feb 2012 21:24:55 +0000 (22:24 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 9 Feb 2012 21:24:55 +0000 (22:24 +0100)
lisp/mm-decode.el

index dc29718..6ec226f 100644 (file)
@@ -945,15 +945,17 @@ external if displayed external."
                           (condition-case nil
                               (delete-directory (file-name-directory file))
                             (error))
-                          (with-current-buffer outbuf
-                            (let ((buffer-read-only nil)
-                                  (point (point)))
-                              (forward-line 2)
-                              (mm-insert-inline
-                               handle (with-current-buffer buffer
-                                        (buffer-string)))
-                              (goto-char point)))
-                          (kill-buffer buffer))
+                          (when (buffer-live-p outbuf)
+                            (with-current-buffer outbuf
+                              (let ((buffer-read-only nil)
+                                    (point (point)))
+                                (forward-line 2)
+                                (mm-insert-inline
+                                 handle (with-current-buffer buffer
+                                          (buffer-string)))
+                                (goto-char point))))
+                          (when (buffer-live-p buffer)
+                            (kill-buffer buffer)))
                         (message "Displaying %s...done" command)))))
                (mm-handle-set-external-undisplayer
                 handle (cons file buffer)))