summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 0ee48bb3725..5e697d350ff 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2859,10 +2859,13 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
case Smath:
if (!sexpflag)
break;
- temp_pos = dec_bytepos (from_byte);
- UPDATE_SYNTAX_TABLE_BACKWARD (from - 1);
- if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos))
- DEC_BOTH (from, from_byte);
+ if (from > BEGV)
+ {
+ temp_pos = dec_bytepos (from_byte);
+ UPDATE_SYNTAX_TABLE_BACKWARD (from - 1);
+ if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos))
+ DEC_BOTH (from, from_byte);
+ }
if (mathexit)
{
mathexit = 0;