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:
@@ -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" ) )
|
||||
|
||||
Reference in New Issue
Block a user