1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-25 02:47:39 +00:00

Fix NPE when checking URLs

If the host was null due to a malformed URL, we'd try to verify that it
was allowed, throwing an NPE.

Fixes #135
This commit is contained in:
SquidDev
2019-03-10 10:45:30 +00:00
parent 52e1906d42
commit 35ce0974cd
2 changed files with 3 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ public class HttpRequest extends Resource<HttpRequest>
{
// Validate the URL
if( url.getScheme() == null ) throw new HTTPRequestException( "Must specify http or https" );
if( url.getHost() == null ) throw new HTTPRequestException( "URL malformed" );
String scheme = url.getScheme().toLowerCase( Locale.ROOT );
if( !scheme.equalsIgnoreCase( "http" ) && !scheme.equalsIgnoreCase( "https" ) )