unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] [minimap] Fix minimap-kill when there is no timer object
@ 2020-09-13 11:23 Adam Spiers
  2020-09-13 14:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2020-09-13 11:23 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] [minimap] Fix minimap-kill when there is no timer object
@ 2020-09-13 11:39 emacs-devel
  0 siblings, 0 replies; 3+ messages in thread
From: emacs-devel @ 2020-09-13 11:39 UTC (permalink / raw)
  To: emacs-devel

From: Adam Spiers <emacs@adamspiers.org>

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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [minimap] Fix minimap-kill when there is no timer object
  2020-09-13 11:23 Adam Spiers
@ 2020-09-13 14:13 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 14:13 UTC (permalink / raw)
  To: Adam Spiers; +Cc: emacs-devel

Adam Spiers <emacs@adamspiers.org> writes:

> 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.

Thanks; applied to the minimap package.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-13 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13 11:39 [PATCH] [minimap] Fix minimap-kill when there is no timer object emacs-devel
  -- strict thread matches above, loose matches on Subject: below --
2020-09-13 11:23 Adam Spiers
2020-09-13 14:13 ` Lars Ingebrigtsen

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).