mirror of
https://github.com/nlohmann/json.git
synced 2025-08-06 07:02:42 +03:00
PrettyPrinter: Check if match is valid before accessing group (#3920)
This commit is contained in:
@@ -14,7 +14,7 @@ class JsonValuePrinter:
|
|||||||
return self.val
|
return self.val
|
||||||
|
|
||||||
def json_lookup_function(val):
|
def json_lookup_function(val):
|
||||||
m = ns_pattern.fullmatch(val.type.strip_typedefs().name)
|
if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
|
||||||
name = m.group('name')
|
name = m.group('name')
|
||||||
if name and name.startswith('basic_json<') and name.endswith('>'):
|
if name and name.startswith('basic_json<') and name.endswith('>'):
|
||||||
m = ns_pattern.fullmatch(str(val['m_type']))
|
m = ns_pattern.fullmatch(str(val['m_type']))
|
||||||
|
Reference in New Issue
Block a user