TypeError: Cannot read property 'split' of null

I am suddenly getting this error code on my dynamic item page.
const dynamicPageURLs = local.getItem(selectedGallery).split(‘,’);

I’d appreciate some help with this. Many thanks.
Anno

Hi Anno,
Method getItem of local is expecting to receive a string. Moreover, if no item was set before it should return null. So, cannot read property ‘split’ of null.
My suggestion is first a all to make sure to call getItem with a string (or variable that refers to a string). Second is to split dynamicPageURLS like this:

const dynamicPageURLs = local.getItem(selectedGallery);
const dynamicPageURLsSplited = dynamicPageURLs ? dynamicPageURLs.split(',') : dynamicPageURLs;

Please update in your progress.
Roi