Skip to content

Commit 3537935

Browse files
committed
Add nil check for img
1 parent 92152c6 commit 3537935

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

components/camera/camera.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ func GetImageFromGetImages(ctx context.Context, sourceName *string, mimeType str
194194
}
195195
}
196196

197+
if img == nil {
198+
return nil, ImageMetadata{}, errors.New("image is nil")
199+
}
200+
197201
imgBytes, err := rimage.EncodeImage(ctx, img, mimeType)
198202
if err != nil {
199203
return nil, ImageMetadata{}, fmt.Errorf("could not encode image: %w", err)

0 commit comments

Comments
 (0)