summaryrefslogtreecommitdiff
path: root/mu4e
diff options
context:
space:
mode:
authordjcb <djcb@djcbsoftware.nl>2014-09-23 00:36:31 +0300
committerdjcb <djcb@djcbsoftware.nl>2014-09-23 00:36:31 +0300
commitefb40abaa12db6ab1f8043f6e6e4c4c18ed087a3 (patch)
tree2b7fb93c88393d26bd781a5f7e211ad453e29923 /mu4e
parentea5bbdf83091e32f4801e0be19c3b9c36217369d (diff)
Guard against nil in mu4e~guess-maildir (Fixes #472)
Add a guard so we don't error out if string-match evaluates to nil
Diffstat (limited to 'mu4e')
-rw-r--r--mu4e/mu4e-utils.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el
index 87d79cb..57892d5 100644
--- a/mu4e/mu4e-utils.el
+++ b/mu4e/mu4e-utils.el
@@ -1,6 +1,6 @@
;;; mu4e-utils.el -- part of mu4e, the mu mail user agent
;;
-;; Copyright (C) 2011-2012 Dirk-Jan C. Binnema
+;; Copyright (C) 2011-2014 Dirk-Jan C. Binnema
;; Copyright (C) 2013 Tibor Simko
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@@ -154,12 +154,13 @@ see its docstring)."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e~guess-maildir (path)
"Guess the maildir for some path, or nil if cannot find it."
- (when (zerop (string-match mu4e-maildir path))
- (replace-regexp-in-string
- mu4e-maildir
- ""
- (expand-file-name
- (concat path "/../..")))))
+ (let ((idx (string-match mu4e-maildir path)))
+ (when (and idx (zerop idx))
+ (replace-regexp-in-string
+ mu4e-maildir
+ ""
+ (expand-file-name
+ (concat path "/../.."))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;