Skip to content
Snippets Groups Projects
Commit 60cdf9e8 authored by Chris Beer's avatar Chris Beer
Browse files

Guard against literal null values in metadata; fixes #3035

parent 7f915bf3
No related branches found
No related tags found
No related merge requests found
......@@ -360,6 +360,8 @@ describe('getMetadataLocales', () => {
label: 'Some label',
value: { '@language': 'one-value', '@value': '1' },
},
{ label: 'Bad value', value: null },
{ label: null, value: 'Bad label' },
],
};
const state = { manifests: { x: { json: manifest } } };
......
......@@ -338,9 +338,10 @@ export const getManifestMetadata = createSelector(
/** */
function getLocalesForStructure(item) {
const languages = [];
if (Array.isArray(item)) {
languages.push(...item.filter(i => (typeof i === 'object' && i['@language'])).map(i => i['@language']));
} else if (typeof item === 'object') {
} else if (item && typeof item === 'object') {
if (item['@language']) languages.push(item['@language']);
}
return languages;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment