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:
parent
688c9b4aac
commit
f3955789de
1 changed files with 5 additions and 1 deletions
|
@ -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$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue