Mercurial > hg > icedtea9-forest > jdk
changeset 4856:aa3f5117c485
7099251: javax.swing.text.html.HTMLDocument.insertAfterStart(null, something) throws NPE
Reviewed-by: rupashka
Contributed-by: alexandr.scherbatiy@oracle.com
author | rupashka |
---|---|
date | Mon, 17 Oct 2011 15:10:42 +0400 |
parents | 98901d41e1e2 |
children | 4f74e3fdf86b |
files | src/share/classes/javax/swing/text/html/HTMLDocument.java |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Oct 11 15:22:40 2011 +0400 +++ b/src/share/classes/javax/swing/text/html/HTMLDocument.java Mon Oct 17 15:10:42 2011 +0400 @@ -1181,7 +1181,12 @@ 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"); }