diff options
| author | Francesco Abbate <francesco.bbt@gmail.com> | 2022-01-25 14:14:56 +0100 |
|---|---|---|
| committer | Francesco Abbate <francesco.bbt@gmail.com> | 2022-01-25 14:16:40 +0100 |
| commit | 3a53b05b29b409d0602ab91e97d45f182106e41e (patch) | |
| tree | a89c9f4439440aed6027e50be3e58422b59eea45 /data | |
| parent | 3e39da071da130e3539227107d273f6d1b6a79ae (diff) | |
| download | lite-xl-merge-master-2.0.tar.gz lite-xl-merge-master-2.0.zip | |
Do no error out on malformed ignore patternsmerge-master-2.0
Diffstat (limited to 'data')
| -rw-r--r-- | data/core/init.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/data/core/init.lua b/data/core/init.lua index 366d1048..743d6ca1 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -136,12 +136,15 @@ local function compile_ignore_files() -- config.ignore_files could be a simple string... if type(ipatterns) ~= "table" then ipatterns = {ipatterns} end for i, pattern in ipairs(ipatterns) do - compiled[i] = { - use_path = pattern:match("/[^/$]"), -- contains a slash but not at the end - -- An '/' or '/$' at the end means we want to match a directory. - match_dir = pattern:match(".+/%$?$"), -- to be used as a boolen value - pattern = pattern -- get the actual pattern - } + -- we ignore malformed pattern that raise an error + if pcall(string.match, "a", pattern) then + table.insert(compiled, { + use_path = pattern:match("/[^/$]"), -- contains a slash but not at the end + -- An '/' or '/$' at the end means we want to match a directory. + match_dir = pattern:match(".+/%$?$"), -- to be used as a boolen value + pattern = pattern -- get the actual pattern + }) + end end return compiled end |
