diff --git a/yasnippet.el b/yasnippet.el index 82f95d9..9e27984 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -803,10 +803,12 @@ will be deleted before inserting template." ;; Step 16: Do necessary indenting (save-excursion - (goto-char (overlay-start (yas/snippet-overlay snippet))) - (while (re-search-forward "$>" nil t) - (replace-match "") - (indent-according-to-mode))))))) + (let ((ovst (overlay-start (yas/snippet-overlay snippet)))) + (when ovst + (goto-char ovst) + (while (re-search-forward "$>" nil t) + (replace-match "") + (indent-according-to-mode))))))))) (defun yas/current-snippet-overlay (&optional point) "Get the most proper overlay which is belongs to a snippet."