Skip to content

Commit

Permalink
Fix null pointer exception (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis authored Jun 19, 2023
1 parent 4ad3f58 commit 7fcd47d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ public TileCache(TileStore tileStore, CaffeineSpec spec) {
/** {@inheritDoc} */
@Override
public ByteBuffer read(TileCoord tileCoord) throws TileStoreException {
return cache.get(tileCoord, t -> {
var buffer = cache.get(tileCoord, t -> {
try {
var buffer = tileStore.read(t);
if (buffer == null) {
return null;
} else {
return buffer;
}
return tileStore.read(t);
} catch (TileStoreException e) {
logger.error("Unable to read the tile.", e);
return null;
}
}).duplicate();
});
if (buffer == null) {
return null;
} else {
return buffer.duplicate();
}
}

/** {@inheritDoc} */
Expand Down

0 comments on commit 7fcd47d

Please sign in to comment.