branch: elpa/magit
commit 99d0b6e2f3a8279f502a9a55d849a64439c98753
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-diff-visit--sides: Handle nil line
For a merely renamed file line is nil.
---
lisp/magit-diff.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 492acf3bc23..3b6ff333d54 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1794,19 +1794,19 @@ the Magit-Status buffer for DIRECTORY."
(list new-rev new-file))))
(defun magit-diff-visit--position (buffer rev file goto-from goto-file)
- (and-let ((hunk (magit-diff--hunk-section)))
- (let ((line (magit-diff-hunk-line hunk goto-from))
- (column (magit-diff-hunk-column hunk goto-from)))
- (with-current-buffer buffer
- (when (and goto-file (not (equal rev "{worktree}")))
- (setq line (magit-diff-visit--offset
- file (if (equal rev "{index}") nil rev) line)))
- (save-restriction
- (widen)
- (goto-char (point-min))
- (forward-line (1- line))
- (move-to-column column)
- (point))))))
+ (and-let* ((hunk (magit-diff--hunk-section))
+ (line (magit-diff-hunk-line hunk goto-from))
+ (column (magit-diff-hunk-column hunk goto-from)))
+ (with-current-buffer buffer
+ (when (and goto-file (not (equal rev "{worktree}")))
+ (setq line (magit-diff-visit--offset
+ file (if (equal rev "{index}") nil rev) line)))
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (forward-line (1- line))
+ (move-to-column column)
+ (point)))))
(defun magit-diff-hunk-line (section goto-from)
(save-excursion