(cookieHeader || '').split(/; */).forEach((field) => {
const [ name, value ] = common.splitFirst(field, '=', null).map((x) => x && decodeURIComponent(x.trim()));
if (name && !(name in cookie)) {
- if (value && value.startsWith('"') && value.endsWith('"')) {
+ if (value?.startsWith('"') && value.endsWith('"')) {
cookie[name] = value.slice(1, -1); // eslint-disable-line security/detect-object-injection
} else {
cookie[name] = value; // eslint-disable-line security/detect-object-injection