mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-25 23:37:37 +00:00
Prevent nil pointer deref in GetImage
Trying to print the image id on a failed inspect will result in a nil pointer panic because the image will be nil. Replace image.id with the image name which is defined as a string without the use of inspect. Fixes: bz#2131836 [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
parent
7154106256
commit
94d685c0d5
1 changed files with 1 additions and 1 deletions
|
|
@ -404,7 +404,7 @@ func GetImage(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
inspect, err := handlers.ImageDataToImageInspect(r.Context(), newImage)
|
||||
if err != nil {
|
||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed to convert ImageData to ImageInspect '%s': %w", inspect.ID, err))
|
||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed to convert ImageData to ImageInspect '%s': %w", name, err))
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusOK, inspect)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue