Skip to content

Commit

Permalink
Resolve potential NPE in SchemaResourceResolver
Browse files Browse the repository at this point in the history
The LSResourceResolver interface specifies that the systemId parameter may be null. The SchemaResourceResolver uses this argument without checking for this which can result a NullPointerException. This patch adds an extra null check before using the parameter.
  • Loading branch information
pepijnve authored and flavorjones committed Aug 18, 2021
1 parent dc61332 commit 88911fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/java/nokogiri/XmlSchema.java
Expand Up @@ -276,7 +276,7 @@ private class SchemaResourceResolver implements LSResourceResolver
String systemId,
String baseURI)
{
if (noNet && (systemId.startsWith("http://") || systemId.startsWith("ftp://"))) {
if (noNet && systemId != null && (systemId.startsWith("http://") || systemId.startsWith("ftp://"))) {
if (systemId.startsWith(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
return null; // use default resolver
}
Expand Down

0 comments on commit 88911fe

Please sign in to comment.