From ff53f737f80da6d9aaeb7b9c1a117ff07a1e6870 Mon Sep 17 00:00:00 2001 From: Douglas Bacon Date: Wed, 24 Jun 2020 10:16:58 -0400 Subject: [PATCH] catch TypeError when PCRE2 is not available --- terminatorlib/searchbar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/terminatorlib/searchbar.py b/terminatorlib/searchbar.py index 4160ddfd..35c64dc1 100644 --- a/terminatorlib/searchbar.py +++ b/terminatorlib/searchbar.py @@ -119,7 +119,13 @@ class Searchbar(Gtk.HBox): toggled_state = toggled.get_active() if not toggled_state: # Add the CASELESS regex flags when the checkbox is not checked. - self.regex_flags_pcre2 = (regex.FLAGS_PCRE2 | regex.PCRE2_CASELESS) + try: + self.regex_flags_pcre2 = (regex.FLAGS_PCRE2 | regex.PCRE2_CASELESS) + except TypeError: + # if PCRE2 support is not available + pass + + # The code will fall back to use this GLib regex when PCRE2 is not available self.regex_flags_glib = (regex.FLAGS_GLIB | regex.GLIB_CASELESS) else: # Default state of the check box is unchecked. CASELESS regex flags are not added.