1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Possible NPE if document element is empty

This commit is contained in:
Andrew Gvozdev 2009-11-13 03:40:15 +00:00
parent 688c9b4aac
commit f3955789de

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@ -43,7 +44,10 @@ public class XmlUtil {
*/
public static void prettyFormat(Document doc, String ident) {
doc.normalize();
prettyFormat(doc.getDocumentElement(), "", ident); //$NON-NLS-1$
Element documentElement = doc.getDocumentElement();
if (documentElement!=null) {
prettyFormat(documentElement, "", ident); //$NON-NLS-1$
}
}
/**