1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 00:38:52 -05:00

Fix potential NPE (e.g. for XML pages that respond with 404 NOT FOUND)

@see https://www.filebot.net/forums/viewtopic.php?f=10&t=3989&p=22375#p22375
This commit is contained in:
Reinhard Pointner 2016-07-27 18:44:36 +08:00
parent bcc581c10a
commit 2701b16744

View File

@ -67,11 +67,12 @@ public final class XPathUtilities {
}
public static String getAttribute(String attribute, Node node) {
Node attributeNode = node.getAttributes().getNamedItem(attribute);
if (attributeNode != null)
return attributeNode.getNodeValue().trim();
if (node != null) {
Node attr = node.getAttributes().getNamedItem(attribute);
if (attr != null) {
return attr.getNodeValue().trim();
}
}
return null;
}