Commit cdb30ef
committed
Fix TypeError in by_name() when name is not found
When using `match="equals"` (the default), `by_name()` would return
`None` from `dict.get(name, None)` if the name wasn't found in the
lookup cache. This caused `len(matches)` on line 51 to raise:
TypeError: object of type 'NoneType' has no len()
This fix changes the default value from `None` to `[]` (empty list),
making it consistent with the `match="contains"` branch which already
initializes `matches = []`.1 parent c13bab0 commit cdb30ef
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
0 commit comments