Merge pull request #2026 from balena-io/fix-device-issue

Fix error displaying info for devices without commits
This commit is contained in:
bulldozer-balena[bot] 2020-09-08 18:14:24 +00:00 committed by GitHub
commit bd5bf0135a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,10 @@ export default class DeviceCmd extends Command {
: 'N/a';
device.device_type = device.is_of__device_type[0].slug;
device.commit = (device.is_running__release as Release[])[0].commit;
const isRunningRelease = device.is_running__release as Release[];
device.commit = isRunningRelease?.[0] ? isRunningRelease[0].commit : 'N/a';
device.last_seen = device.last_connectivity_event ?? undefined;
// Memory/Storage are really MiB