Skip to content

Commit

Permalink
Null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Jan 27, 2025
1 parent 12e80c3 commit cc5fae2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public String getHost() {

@Override
public String getPath() {
return uri.getPath();
return uri == null ? null : uri.getPath();
}

@Override
Expand Down Expand Up @@ -184,6 +184,9 @@ protected Address parseAddress() {
* @return the parsed address, or null if the host is invalid
*/
protected Address parseAddressByUrl() {
if (uri == null) {
return null;
}
String host = uri.getHost();
int port = uri.getPort();
return validateHost(host) ? new Address(host, port < 0 ? null : port) : null;
Expand Down Expand Up @@ -248,7 +251,6 @@ protected boolean validateHost(String host) {
* @return The scheme, or null if it cannot be determined.
*/
protected String parseScheme() {
URI uri = getURI();
return uri == null ? null : uri.getScheme();
}

Expand Down

0 comments on commit cc5fae2

Please sign in to comment.