plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.66k stars 878 forks source link

Two-dimensional matrices with more than two columns not rendering #1706

Closed ouss1002 closed 1 month ago

ouss1002 commented 2 months ago

Describe the bug When trying to render a matrix with three columns or more, the rendering fails with the exception java.lang.NullPointerException: Cannot invoke "java.util.List.get(int)" because the return value of "java.util.List.get(int)" is null at net.sourceforge.plantuml.math.ASCIIMathTeXImg.AMTparseExpr(ASCIIMathTeXImg.java:938)

To Reproduce 1- Create a matrix (at least two rows) with three columns or more 2- Wrap it inside of a @startmath ... @endmath block 3- Render the matrix.

Example:

@startmath
H = [[1,2,3],[4,5,6]]
@endmath

Expected behavior The matrix renders correctly, regardless of the number of rows/columns.

Actual behavior A java.lang.NullPointerException is thrown, and the rendering is buggy/faulty for the matrix

Screenshots Here are the results with their corresponding matrix code: image

The problem only arises if the matrix has at least two rows and three columns !

Desktop:

OS: Windows server 2019 Browser chrome

Additional context The matrices used to render correctly back in the version V1.2021.7 where the javascript engine used to be the one that renders the matrices. This is a regression as noted on the PlantUML website regarding potential regressions post-migration into Java in V1.2021.8

PlantUML version : 1.2024.3

ouss1002 commented 2 months ago

Thank you very much @The-Lum for fixing the the issue ! I have a question, will this fix be part of the next release ? ping @arnaudroques

Regards, Oussama

The-Lum commented 23 hours ago

Hi @ouss1002,

See also new enhancements here:

Regards, Th.