Commit a5a69f12 authored by herbetom's avatar herbetom Committed by David Bauer
Browse files

app: fix potential null reference

Without the if it was possible that images[vendor] was
undefined because their was no image available for that
vendor. And then `Object.entries(images[vendor])` resulted in:

Uncaught TypeError: Cannot convert undefined or null to object

And this led to the problem that no device at all was shown :(

Fixes d45019d1 ("app: filter vendors without images for enabled device categories")
Fixes #118
Closes #122
parent 93dbaa8b
......@@ -727,9 +727,11 @@ var firmwarewizard = function() {
function hasVendorDevicesForEnabledDeviceCategories(vendor) {
var image_vendors = Object.keys(images);
for (let [key, value] of Object.entries(images[vendor])) {
if (enabled_device_categories.includes(value[0].category)) {
return true;
if (images[vendor]) {
for (let [key, value] of Object.entries(images[vendor])) {
if (enabled_device_categories.includes(value[0].category)) {
return true;
}
}
}
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment