[meld] misc: Skip missing filter regexes when matching (#442)



commit 05451d845645be4b7724eef353f2309250f4d527
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu Apr 16 07:13:01 2020 +1000

    misc: Skip missing filter regexes when matching (#442)
    
    When compiling our filter regular expressions, we set the compiled regex
    to `None` on compilation errors. While this isn't ideal, it's basically
    sensible. However, we then explode when actually trying to match this
    filter because we don't ignore the missing compiled regex. This patch
    changes that so that we skip these errors.

 meld/misc.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/meld/misc.py b/meld/misc.py
index b48b9cec..b0acec55 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -389,6 +389,9 @@ def apply_text_filters(
 
     filter_ranges = []
     for r in regexes:
+        if not r:
+            continue
+
         for match in r.finditer(txt):
 
             # If there are no groups in the match, use the whole match


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]