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
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 99c87cf118 Fix a `NullPointerException` when user is interrested only
in the derivative.
99c87cf118 is described below
commit 99c87cf118f162288f6dc018a4a10920e1e7b46b
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat Aug 20 16:37:59 2022 +0200
Fix a `NullPointerException` when user is interrested only in the
derivative.
---
.../sis/referencing/operation/projection/LongitudeWraparound.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LongitudeWraparound.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LongitudeWraparound.java
index 98da9b1472..b6bc79ab9a 100644
---
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LongitudeWraparound.java
+++
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LongitudeWraparound.java
@@ -183,11 +183,15 @@ final class LongitudeWraparound extends
AbstractMathTransform2D implements Seria
* The wraparound is applied, if needed, on the longitude value before to
delegate to {@link #projection}.
*/
@Override
- public Matrix transform(final double[] srcPts, final int srcOff,
- final double[] dstPts, final int dstOff, boolean
derivate) throws TransformException
+ public Matrix transform(final double[] srcPts, final int srcOff, double[]
dstPts, int dstOff, final boolean derivate)
+ throws TransformException
{
final double λ = srcPts[srcOff];
if (negative ? λ < bound : λ > bound) {
+ if (dstPts == null) {
+ dstPts = new double[DIMENSION];
+ dstOff = 0;
+ }
dstPts[dstOff+1] = srcPts[srcOff+1]; // Must be first.
dstPts[dstOff ] = λ - 2*bound;
return projection.transform(dstPts, dstOff, dstPts, dstOff,
derivate);