- Reapply the previous NPE fix.

This commit is contained in:
Agetian
2014-01-27 16:06:36 +00:00
parent 0f5eb7d5f8
commit 5322d5a9c2

View File

@@ -5,8 +5,6 @@ import javax.swing.SwingUtilities;
import forge.gui.toolbox.FSkin.SkinnedEditorPane;
import org.apache.commons.lang3.StringUtils;
/**
* Viewer for HTML
*
@@ -35,12 +33,7 @@ public class FHtmlViewer extends SkinnedEditorPane {
public void setText(final String text) {
SwingUtilities.invokeLater( new Runnable() { //need to invokeLater to avoid flicker
public void run() {
if ( StringUtils.isBlank(text) ) {
setSuperText("");
return;
}
setSuperText(text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
setSuperText(null == text ? "" : text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
setCaretPosition(0); //keep scrolled to top
}
});