Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
...@@ -727,11 +727,13 @@ var firmwarewizard = function() { ...@@ -727,11 +727,13 @@ var firmwarewizard = function() {
function hasVendorDevicesForEnabledDeviceCategories(vendor) { function hasVendorDevicesForEnabledDeviceCategories(vendor) {
var image_vendors = Object.keys(images); var image_vendors = Object.keys(images);
if (images[vendor]) {
for (let [key, value] of Object.entries(images[vendor])) { for (let [key, value] of Object.entries(images[vendor])) {
if (enabled_device_categories.includes(value[0].category)) { if (enabled_device_categories.includes(value[0].category)) {
return true; return true;
} }
} }
}
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment