Skip to content

Commit

Permalink
fix: unhandled exception when invalid category is passed to `accepted…
Browse files Browse the repository at this point in the history
…Category`

The small change prevents passing undefined to a function that expects an Array by providing a fallback.
  • Loading branch information
Idrinth authored and orestbida committed Apr 1, 2024
1 parent 674cfde commit 3758404
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const acceptService = (service, category) => {
*/
export const acceptedService = (service, category) => {
const acceptedServices = !globalObj._state._invalidConsent
? globalObj._state._acceptedServices[category]
? (globalObj._state._acceptedServices[category] || [])
: [];

return elContains(acceptedServices, service);
Expand Down

0 comments on commit 3758404

Please sign in to comment.