summaryrefslogtreecommitdiff
path: root/lisp/epa-file.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r--lisp/epa-file.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index e46e3684c8a..33bf5adabe6 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -198,7 +198,9 @@ encryption is used."
(mapcar #'car (epg-context-result-for
context 'encrypted-to)))
(if (or beg end)
- (setq string (substring string (or beg 0) end)))
+ (setq string (substring string
+ (or beg 0)
+ (and end (min end (length string))))))
(save-excursion
;; If visiting, bind off buffer-file-name so that
;; file-locking will not ask whether we should