# HG changeset patch # User rupashka # Date 1318849842 -14400 # Node ID bf858c670ee2290e9be6d525323fea6a073b8052 # Parent 50cda9bfed7e44130c126569fa51aa2148237755 7099251: javax.swing.text.html.HTMLDocument.insertAfterStart(null, something) throws NPE Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy@oracle.com diff -r 50cda9bfed7e -r bf858c670ee2 jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java --- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Oct 11 15:22:40 2011 +0400 +++ b/jdk/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"); }