This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 1a5dc6fd81f665348349685f8b38416aa61df990
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Wed Jan 26 18:35:41 2022 +0100

    Fix a `NullPointerException`.
---
 .../org/apache/sis/storage/geotiff/MultiResolutionImage.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
index 84e550e..2c35a2d 100644
--- 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
+++ 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
@@ -164,8 +164,15 @@ final class MultiResolutionImage extends 
GridResourceWrapper {
      */
     @Override
     public GridCoverage read(final GridGeometry domain, final int... range) 
throws DataStoreException {
-        final double[] request = domain.getResolution(true);
-        int level = resolutions.length;
+        final double[] request;
+        int level;
+        if (domain != null && domain.isDefined(GridGeometry.RESOLUTION)) {
+            request = domain.getResolution(true);
+            level   = resolutions.length;
+        } else {
+            request = null;
+            level   = 1;
+        }
         synchronized (getSynchronizationLock()) {
 finer:      while (--level > 0) {
                 final double[] resolution = resolution(level);

Reply via email to