1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 13:55:03 -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) { public static String getAttribute(String attribute, Node node) {
Node attributeNode = node.getAttributes().getNamedItem(attribute); if (node != null) {
Node attr = node.getAttributes().getNamedItem(attribute);
if (attributeNode != null) if (attr != null) {
return attributeNode.getNodeValue().trim(); return attr.getNodeValue().trim();
}
}
return null; return null;
} }