Skip to content

Commit

Permalink
BUG: Prevent thrown TypeError when category is unknown
Browse files Browse the repository at this point in the history
The small change prevents passing undefined to a function that expects an Array by providing a fallback.
  • Loading branch information
Idrinth authored Mar 19, 2024
1 parent 674cfde commit 5c76573
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 5c76573

Please sign in to comment.