Skip to content

Commit

Permalink
Better null handling
Browse files Browse the repository at this point in the history
  • Loading branch information
joegallo committed Oct 15, 2024
1 parent d5fae2a commit cba0c56
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public HttpClient.PasswordAuthenticationHolder buildCredentials() {

@Override
public boolean validCredentials() {
return auth.get() != null;
return auth != null && auth.get() != null;
}

@Override
Expand Down Expand Up @@ -541,7 +541,7 @@ public CheckedSupplier<InputStream, IOException> download() {

@Override
public void close() throws IOException {
auth.close();
if (auth != null) auth.close();
}
}

Expand Down Expand Up @@ -572,7 +572,7 @@ public HttpClient.PasswordAuthenticationHolder buildCredentials() {

@Override
public boolean validCredentials() {
return auth.get() != null;
return auth != null && auth.get() != null;
}

private static final Set<String> FREE_DATABASES = Set.of("asn", "country", "country_asn");
Expand Down Expand Up @@ -635,7 +635,7 @@ public CheckedSupplier<InputStream, IOException> download() {

@Override
public void close() throws IOException {
auth.close();
if (auth != null) auth.close();
}
}

Expand Down

0 comments on commit cba0c56

Please sign in to comment.