         ;; Check if we should cancel the timer.
         (when (and (not global-auto-revert-mode)
                    (null auto-revert-buffer-list))
-          (cancel-timer auto-revert-timer)
+          (if (timerp auto-revert-timer)
+              (cancel-timer auto-revert-timer))
           (setq auto-revert-timer nil)))))
 
   :config


  (defcustom counsel-mode-override-describe-bindings nil
    "Whether to override `describe-bindings' when `counsel-mode' is active."
    :group 'ivy
    :type 'boolean)

  (define-minor-mode counsel-mode


Local bindings (`counsel-mode-map'):
\\{counsel-mode-map}"
    :global t
    :keymap counsel-mode-map
    (el-patch-remove
