From a0db06b907c8f480226e5758885a0590b29afdc7 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 12 Nov 2018 12:31:52 -0500 Subject: Handle potential mismatch between snippet in buffer and snippet in memory. Snippet prev/next coupled with subsequent edits may cause the buffer to contain an unexpected snippet placeholder. Handle it gracefully. --- modules/textadept/snippets.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua index f7239ef3..c7ff417a 100644 --- a/modules/textadept/snippets.lua +++ b/modules/textadept/snippets.lua @@ -551,7 +551,8 @@ M._snippet_mt = { end local id = buffer:indicator_value_at(M.INDIC_PLACEHOLDER, s) local ph = snapshot.placeholders[id] - if (not index or ph.index == index) and (not type or ph[type]) then + if ph and (not index or ph.index == index) and + (not type or ph[type]) then return s, ph end s = buffer:indicator_end(M.INDIC_PLACEHOLDER, i) -- cgit v1.2.3