unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Spiers <emacs@adamspiers.org>
To: emacs-devel@gnu.org
Subject: [PATCH] [minimap] Fix minimap-kill when there is no timer object
Date: Sun, 13 Sep 2020 12:23:24 +0100	[thread overview]
Message-ID: <20200913112324.6088-1-emacs@adamspiers.org> (raw)

Occasionally minimap-timer-object can be nil when minimap-killer
is triggered.  In this case, the following error is triggered:

    cancel-timer: Wrong type argument: timerp, nil

So defensively check whether there is a timer to cancel before trying
to cancel it.

Signed-off-by: Adam Spiers <emacs@adamspiers.org>
---
 packages/minimap/minimap.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/minimap/minimap.el b/packages/minimap/minimap.el
index c360673c4..73d7fb2f1 100644
--- a/packages/minimap/minimap.el
+++ b/packages/minimap/minimap.el
@@ -531,7 +531,8 @@ (defun minimap-kill ()
   (interactive)
   (when (minimap-get-window)
     (delete-window (minimap-get-window)))
-  (cancel-timer minimap-timer-object))
+  (when minimap-timer-object
+    (cancel-timer minimap-timer-object)))
 
 ;;; Minimap update
 
-- 
2.28.0




             reply	other threads:[~2020-09-13 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 11:23 Adam Spiers [this message]
2020-09-13 14:13 ` [PATCH] [minimap] Fix minimap-kill when there is no timer object Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2020-09-13 11:39 emacs-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200913112324.6088-1-emacs@adamspiers.org \
    --to=emacs@adamspiers.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).