From commits-return-13791-apmail-sis-commits-archive=sis.apache.org@sis.apache.org Wed Aug 12 17:32:57 2020 Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with ESMTP id 0C09919EB9 for ; Wed, 12 Aug 2020 17:32:57 +0000 (UTC) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id B242E12515D for ; Wed, 12 Aug 2020 17:32:56 +0000 (UTC) Received: (qmail 16479 invoked by uid 500); 12 Aug 2020 17:32:56 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 16419 invoked by uid 500); 12 Aug 2020 17:32:56 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 16372 invoked by uid 99); 12 Aug 2020 17:32:56 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2020 17:32:56 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 14A7082437; Wed, 12 Aug 2020 17:32:56 +0000 (UTC) Date: Wed, 12 Aug 2020 17:32:57 +0000 To: "commits@sis.apache.org" Subject: [sis] 02/04: Fix a NullPointerException. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: desruisseaux@apache.org In-Reply-To: <159725357554.16847.14846740697257018066@gitbox.apache.org> References: <159725357554.16847.14846740697257018066@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: sis X-Git-Refname: refs/heads/geoapi-4.0 X-Git-Reftype: branch X-Git-Rev: f1009c8ffab4efdead8c6f75c02d1245f0909186 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20200812173256.14A7082437@gitbox.apache.org> 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 f1009c8ffab4efdead8c6f75c02d1245f0909186 Author: Martin Desruisseaux AuthorDate: Wed Aug 12 18:50:05 2020 +0200 Fix a NullPointerException. --- .../src/main/java/org/apache/sis/internal/referencing/LazySet.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java index a473300..d41cff3 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java @@ -207,12 +207,15 @@ public class LazySet extends SetOfUnknownSize { } /** - * Caches a new element. Subclasses can override this method is they want to substitute the given value + * Caches a new element. Subclasses can override this method if they want to substitute the given value * by another value. * * @param element the element to add to the cache. */ protected void cache(final E element) { + if (cachedElements == null) { + createCache(); + } if (numCached >= cachedElements.length) { cachedElements = Arrays.copyOf(cachedElements, numCached << 1); }