Skip to content

Commit

Permalink
api/aws: makes import more robust again nil pointer exception
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
  • Loading branch information
tormath1 committed Nov 29, 2024
1 parent a3ee855 commit db2a9b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions platform/api/aws/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit db2a9b1

Please sign in to comment.