diff --git a/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.java b/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.java index 6aec5694c..7a23f2667 100644 --- a/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.java +++ b/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.java @@ -602,7 +602,7 @@ public class ASCIIMathTeXImg { case CONST: str = AMremoveCharsAndBlanks(str, symbol.input.length()); String texsymbol = AMTgetTeXsymbol(symbol); - if (texsymbol.charAt(0) == '\\' || symbol.tag.equals("mo")) + if (texsymbol.isEmpty() || texsymbol.charAt(0) == '\\' || symbol.tag.equals("mo")) return new String[] { texsymbol, str }; else { return new String[] { "{" + texsymbol + "}", str }; @@ -676,7 +676,7 @@ public class ASCIIMathTeXImg { if (result[0] == null) return new String[] { "{" + AMTgetTeXsymbol(symbol) + "}", str }; if (symbol.hasFlag("func")) { // functions hack - st = "" + str.charAt(0); + st = "" + (str.isEmpty() ? "" : str.charAt(0)); if (st.equals("^") || st.equals("_") || st.equals("/") || st.equals("|") || st.equals(",") || (symbol.input.length() == 1 && symbol.input.matches("\\w") && !st.equals("("))) { return new String[] { "{" + AMTgetTeXsymbol(symbol) + "}", str };