fix for: TypeError: Cannot read property 'key' of undefined, when accessing http://localhost/bolt/edit/54#media

This commit is contained in:
Wytse Talsma
2020-11-03 17:04:03 +01:00
parent 6ec51bd2dc
commit 50e6f1baf2

View File

@@ -88,8 +88,12 @@ export default {
if (this.selected === null) {
return JSON.stringify([]);
} else if (this.selected.map) {
filtered = this.selected.map(item => item.key);
return JSON.stringify(filtered);
if (typeof item !== 'undefined') {
filtered = this.selected.map(item => item.key);
return JSON.stringify(filtered);
} else {
return JSON.stringify([]);
}
} else {
return JSON.stringify([this.selected.key]);
}