From b62a17d1ccd0802a6ff16727f60f7242008f2deb Mon Sep 17 00:00:00 2001 From: Jude Kwashie Date: Wed, 19 Mar 2025 10:43:40 +0000 Subject: [PATCH] fix(vertex_ai): handle null predictions --- .../firebase_vertexai/lib/src/imagen_content.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart b/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart index e89326e2b303..525cbeef44ed 100644 --- a/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart +++ b/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart @@ -104,7 +104,7 @@ final class ImagenGenerationResponse { /// Factory method to create an [ImagenGenerationResponse] from a JSON object. factory ImagenGenerationResponse.fromJson(Map json) { final predictions = json['predictions']; - if (predictions.isEmpty) { + if (predictions == null || predictions.isEmpty) { throw ServerException('Got empty prediction with no reason'); }