Merge pull request #3165 from balena-io/pr/3162

Fix undefined image from DriveCompatibilityWarning
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2020-05-21 12:05:55 +02:00 committed by GitHub
commit d62cbdc391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,7 @@ export interface Image {
* containing the image. * containing the image.
*/ */
export function isSourceDrive(drive: DrivelistDrive, image: Image): boolean { export function isSourceDrive(drive: DrivelistDrive, image: Image): boolean {
image = image || {};
for (const mountpoint of drive.mountpoints || []) { for (const mountpoint of drive.mountpoints || []) {
if (image.path !== undefined && pathIsInside(image.path, mountpoint.path)) { if (image.path !== undefined && pathIsInside(image.path, mountpoint.path)) {
return true; return true;
@ -164,7 +165,7 @@ export const COMPATIBILITY_STATUS_TYPES = {
*/ */
export function getDriveImageCompatibilityStatuses( export function getDriveImageCompatibilityStatuses(
drive: DrivelistDrive, drive: DrivelistDrive,
image: Image, image: Image = {},
) { ) {
const statusList = []; const statusList = [];