OFFLINE-GmbH / oc-gdpr-plugin

October CMS plugin to make websites GDPR and ePrivacy compliant
https://octobercms.com/plugin/offline-gdpr
MIT License
36 stars 20 forks source link

addToggleEvents, if levels are not defined #60

Closed RonMen closed 5 years ago

RonMen commented 5 years ago

Hi.

In '/components/cookiemanager/scripts.js' in function 'addToggleEvents' the levels can be empty, so setting 'levels.style.display = ...' will run into error.

I think it would be right to check if levels not undefined, so it should be eg. levels && levels.forEach(function(level) { level.style.display = 'block'; }); and levels && levels.forEach(function(level) { level.style.display = 'none'; });

Regards RonMen

tobias-kuendig commented 5 years ago

Good catch, thank you! This is fixed in 404364d and released as v2.0.12