Skip to content

Commit

Permalink
Prevent error when strict_min_version is not a string value (#3913)
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand authored Sep 14, 2021
1 parent b0850dd commit e5e5b55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ export function firefoxStrictMinVersion(manifestJson) {
if (
manifestJson.applications &&
manifestJson.applications.gecko &&
manifestJson.applications.gecko.strict_min_version
manifestJson.applications.gecko.strict_min_version &&
typeof manifestJson.applications.gecko.strict_min_version === 'string'
) {
return parseInt(
manifestJson.applications.gecko.strict_min_version.split('.')[0],
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ describe('firefoxStrictMinVersion', () => {
})
).toEqual(60);
});

it('should return null when value is not a string', () => {
expect(
firefoxStrictMinVersion({
applications: { gecko: { strict_min_version: 12.3 } },
})
).toEqual(null);
});
});

describe('basicCompatVersionComparison', () => {
Expand Down

0 comments on commit e5e5b55

Please sign in to comment.