diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/glob/matcher.lua | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index cb4e6d0f..0be6a699 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ ---@field ['#'] number ``` * `NEW` add supports of `love2d` +* `FIX` gitignore pattern `\` broken initialization +* `FIX` runtime errors ## 2.3.1 `2021-7-19` diff --git a/script/glob/matcher.lua b/script/glob/matcher.lua index f4c2b12c..0a2a740f 100644 --- a/script/glob/matcher.lua +++ b/script/glob/matcher.lua @@ -123,7 +123,12 @@ end function mt:pattern(state) if state.root then - return m.C(self:exp(state, 1)) + local after = self:exp(state, 1) + if after then + return m.C(after) + else + return nil + end else return m.C(self:anyPath(nil, state, 1)) end @@ -147,5 +152,8 @@ return function (state, options) state = state, }, mt) self.matcher = self:pattern(state) + if not self.matcher then + return nil + end return self end |