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 1a3bcee Fix a NullPointerException. 1a3bcee is described below commit 1a3bceee5f3db4ffc38f8e55e1fbe0ab4a1a5bcd Author: Martin Desruisseaux AuthorDate: Mon Apr 20 18:22:51 2020 +0200 Fix a NullPointerException. --- .../java/org/apache/sis/gui/referencing/CRSChooser.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java index f2c427d..603722b 100644 --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java @@ -300,6 +300,10 @@ public class CRSChooser extends Dialog { * the {@link #type} and {@link #domain} fields with CRS information. */ private void updateSummary(final Code selected) { + if (selected == null) { + clearSummary(); + return; + } final AuthorityCodes source = getAuthorityCodes(); final String code = selected.code; BackgroundThreads.execute(new Task() { @@ -318,8 +322,7 @@ public class CRSChooser extends Dialog { /** Invoked in JavaFX thread on cancellation. */ @Override protected void cancelled() { - type.setText(null); - domain.setText(null); + clearSummary(); } /** Invoked in JavaFX thread on failure. */ @@ -332,6 +335,14 @@ public class CRSChooser extends Dialog { } /** + * Clears the {@link #type} and {@link #domain} fields. + */ + private void clearSummary() { + type.setText(null); + domain.setText(null); + } + + /** * Sets the text that describes the domain of validity. */ private void setDomainOfValidity(final Extent domainOfValidity, final Locale locale) {