You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/01/14 23:21:33 UTC
[sis] 03/03: Fix a `NullPointerException` that occurs when a new
window is created.
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 7b07584b9d4e346312525ce4f1ab1b667e2e514d
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jan 15 00:19:08 2021 +0100
Fix a `NullPointerException` that occurs when a new window is created.
---
.../sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
index 7dc4d08..9675146 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
@@ -915,8 +915,12 @@ public abstract class MapCanvas extends PlanarCanvas {
* This code is executed only once for a new map.
*/
if (invalidObjectiveToDisplay) {
- invalidObjectiveToDisplay = false;
final Envelope2D target = getDisplayBounds();
+ if (target == null) {
+ // Bounds are still unknown. Another repaint event will happen when they will become known.
+ return;
+ }
+ invalidObjectiveToDisplay = false;
final GridExtent extent = new GridExtent(null,
new long[] {Math.round(target.getMinX()), Math.round(target.getMinY())},
new long[] {Math.round(target.getMaxX()), Math.round(target.getMaxY())}, false);