Subject: Re: bug#32378: [PATCH] bibtex-next/previous-entry

From: Noam Postavsky <[email-masked]>
Date: Mon, 06 Aug 2018 22:15:18 -0400

Alex Branham <[email-masked]> writes:

> +(defun bibtex-next-entry (&optional arg)
> +  "Move point ARG entries forward."
> +  (interactive "p")
> +  (bibtex-end-of-entry)
> +  (re-search-forward bibtex-entry-maybe-empty-head nil t (or arg 1))
> +  (goto-char (match-beginning 0)))
> +
> +(defun bibtex-previous-entry (&optional arg)
> +  "Move point ARG entries backward."
> +  (interactive "p")
> +  (bibtex-beginning-of-entry)
> +  (re-search-backward bibtex-entry-maybe-empty-head nil t (or arg 1))
> +  (goto-char (match-beginning 0)))

You forgot to check the return value of re-search-forward/backward, if
there is no match then (match-beginning 0) might return something
unexpected.  Alternatively, if you don't expect the match to fail, pass
nil for NOERROR.