mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Reapply the previous NPE fix.
This commit is contained in:
@@ -5,8 +5,6 @@ import javax.swing.SwingUtilities;
|
|||||||
|
|
||||||
import forge.gui.toolbox.FSkin.SkinnedEditorPane;
|
import forge.gui.toolbox.FSkin.SkinnedEditorPane;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Viewer for HTML
|
* Viewer for HTML
|
||||||
*
|
*
|
||||||
@@ -35,12 +33,7 @@ public class FHtmlViewer extends SkinnedEditorPane {
|
|||||||
public void setText(final String text) {
|
public void setText(final String text) {
|
||||||
SwingUtilities.invokeLater( new Runnable() { //need to invokeLater to avoid flicker
|
SwingUtilities.invokeLater( new Runnable() { //need to invokeLater to avoid flicker
|
||||||
public void run() {
|
public void run() {
|
||||||
if ( StringUtils.isBlank(text) ) {
|
setSuperText(null == text ? "" : text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
|
||||||
setSuperText("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSuperText(text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
|
|
||||||
setCaretPosition(0); //keep scrolled to top
|
setCaretPosition(0); //keep scrolled to top
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user