Fix error displaying info for devices without commits

Change-type: patch
Resolves: #2024
Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-09-08 14:13:30 +02:00
parent b9d90b9e38
commit e0c65bdef8

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