Closed M1ra1B0T closed 2 months ago
Do you have some test data or could you add some data to the unit test for this? Maybe I'm missing something but on first glance the previous code should be functionality identical?
In [1]: extension = {}
In [2]: repr(extension.get("defaultLocale", {}).get("name"))
Out[2]: 'None'
In [3]: extension = {"defaultLocale": {}}
In [4]: repr(extension.get("defaultLocale", {}).get("name"))
Out[4]: 'None'
@Schamper The error occurs if the field defaultLocale
is actually None
or null
>>> extension = {"defaultLocale": None}
>>> repr(extension.get("defaultLocale", {}).get("name"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'get'
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 75.05%. Comparing base (
f999b3a
) to head (40fee57
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks! Was actually running into this issue too while working on another feature.
This PR fixes a NoneType AttributeError in the firefox extension plugin. When parsing the firefox extension information from the json file, we use the dictionary get method to access the relevant key value pairs. However, I ran into an uncatched NoneType AttributeError if the original key value is None, but we expect a nested dictionary, e.g. for the "name" field.
Additionally, the error message was slightly adapted, so instead of logging the whole user object, it now only prints the username as it should.