show error message when a text tag is invalid (glyph index is not found in the glyph list)

This commit is contained in:
honfika@gmail.com
2016-02-14 10:54:18 +01:00
parent ddd9f1ca2a
commit 9f40de3a2c

View File

@@ -173,7 +173,14 @@ public class TextPanel extends JPanel implements TagEditorPanel {
public void setText(TextTag textTag) {
this.textTag = textTag;
textValue.setText(textTag.getFormattedText(false).text);
String formattedText;
try {
formattedText = textTag.getFormattedText(false).text;
} catch (IndexOutOfBoundsException ex) {
formattedText = "Invalid text tag";
}
textValue.setText(formattedText);
textValue.setCaretPosition(0);
setModified(false);
setEditText(false);