1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-24 22:07:33 +00:00

fix: ord builtin function: retrieve then cast of the value

By this indication:
- https://github.com/plantuml/plantuml/pull/1487#issuecomment-1646545778

Fix `ord` builtin function:
- retrieve then cast of the value
This commit is contained in:
The-Lum 2023-07-24 14:24:35 +00:00
parent 6e7254377c
commit 823d27afa9

View File

@ -59,7 +59,8 @@ public class Ord extends SimpleReturnFunction {
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
try {
final int value = (int) values.get(0).toString();
final char firstChar = values.get(0).toString().charAt(0);
final int value = (int) firstChar;
return TValue.fromInt(value);
} catch (Throwable t) {
return TValue.fromInt(0);