mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(minor) EdgeUrl.parse() should deal with null
This commit is contained in:
parent
bc330acfc9
commit
7470c170b1
@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import nu.marginalia.util.QueryParams;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@ -33,8 +34,12 @@ public class EdgeUrl {
|
||||
this(new URI(urlencodeFixer(url)));
|
||||
}
|
||||
|
||||
public static Optional<EdgeUrl> parse(String url) {
|
||||
public static Optional<EdgeUrl> parse(@Nullable String url) {
|
||||
try {
|
||||
if (null == url) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.of(new EdgeUrl(url));
|
||||
} catch (URISyntaxException e) {
|
||||
return Optional.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user