diff options
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r-- | src/lstrlib.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js index d3373a4..ba1ef55 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -1044,13 +1044,13 @@ const match = function(ms, s, p) { } break; } - case 'f'.charCodeAt(0): { + case 'f'.charCodeAt(0): { /* frontier? */ p += 2; if (ms.p[p] !== '['.charCodeAt(0)) lauxlib.luaL_error(ms.L, lua.to_luastring("missing '[' after '%%f' in pattern")); let ep = classend(ms, p); /* points to what is next */ let previous = s === ms.src_init ? 0 : ms.src[s-1]; - if (!matchbracketclass(ms, previous, p, ep - 1) && matchbracketclass(ms, ms.src[s], p, ep - 1)) { + if (!matchbracketclass(ms, previous, p, ep - 1) && matchbracketclass(ms, (s===ms.src_end)?0:ms.src[s], p, ep - 1)) { p = ep; gotoinit = true; break; } s = null; /* match failed */ |