7099251: javax.swing.text.html.HTMLDocument.insertAfterStart(null, something) throws NPE

Reviewed-by: rupashka
This commit is contained in:
Alexandr Scherbatiy 2011-10-17 15:10:42 +04:00 committed by Pavel Porvatov
parent 6fb68448cc
commit 224bf60e30

View File

@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument {
public void insertAfterStart(Element elem, String htmlText) throws
BadLocationException, IOException {
verifyParser();
if (elem != null && elem.isLeaf()) {
if (elem == null || htmlText == null) {
return;
}
if (elem.isLeaf()) {
throw new IllegalArgumentException
("Can not insert HTML after start of a leaf");
}