From db2a9b1abb8cae521c90ca5f95ec2fc36a742def Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Fri, 29 Nov 2024 15:47:34 +0100 Subject: [PATCH] api/aws: makes import more robust again nil pointer exception Signed-off-by: Mathieu Tortuyaux --- platform/api/aws/images.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/api/aws/images.go b/platform/api/aws/images.go index 143c0c773..af1916bda 100644 --- a/platform/api/aws/images.go +++ b/platform/api/aws/images.go @@ -207,7 +207,16 @@ func (a *API) finishSnapshotTask(snapshotTaskID, imageName string) (*Snapshot, e return false, "", err } + if len(taskRes.ImportSnapshotTasks) == 0 { + plog.Debugf("no import snapshot tasks in progress") + return false, "", nil + } + details := taskRes.ImportSnapshotTasks[0].SnapshotTaskDetail + if details == nil { + plog.Debugf("no details on the import snapshot task") + return false, "", nil + } // I dream of AWS specifying this as an enum shape, not string switch *details.Status {