提交 6f1bf901 编写于 作者: R rupashka

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

Reviewed-by: rupashka
Contributed-by: alexandr.scherbatiy@oracle.com
上级 2dff74cf
...@@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument { ...@@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument {
public void insertAfterStart(Element elem, String htmlText) throws public void insertAfterStart(Element elem, String htmlText) throws
BadLocationException, IOException { BadLocationException, IOException {
verifyParser(); verifyParser();
if (elem != null && elem.isLeaf()) {
if (elem == null || htmlText == null) {
return;
}
if (elem.isLeaf()) {
throw new IllegalArgumentException throw new IllegalArgumentException
("Can not insert HTML after start of a leaf"); ("Can not insert HTML after start of a leaf");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册