Skip to content

Commit 8354b50

Browse files
committed
fix: handle null for on list Object request
1 parent 3af74d8 commit 8354b50

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/org/janelia/saalfeldlab/n5/s3/AmazonS3KeyValueAccess.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,12 @@ private boolean prefixExists(final String prefix) {
295295

296296
try {
297297
final ListObjectsV2Response objectsListing = queryPrefix(prefix);
298-
return objectsListing.keyCount() > 0;
298+
Integer keyCount = objectsListing.keyCount();
299+
/* keyCount should NEVER be null, and yet we have seen this in the wild... */
300+
return keyCount != null && keyCount > 0;
299301
} catch (NoSuchBucketException e) {
302+
return false;
300303
}
301-
return false;
302304
}
303305

304306
/**

0 commit comments

Comments
 (0)