NullpointException in MatrixAtom

classic Classic list List threaded Threaded
1 message Options
Graeme Kidd Graeme Kidd
Reply | Threaded
Open this post in threaded view
|

NullpointException in MatrixAtom



Hi

I was just trying to convert the following latex into a EPS:

\begin{aligned}
  \text{A } & \text{ =  x}^\text{2} \text{  +  4xh} \\ 
   & \text{ =  x}^\text{2} \text{  +  4x} \times \frac{{\text{4000}}}
{{\text{x}^\text{2} }} \\ 
   & \text{ =  x}^\text{2} \text{  +  }\frac{{\text{16000}}}
{\text{x}} \\ 
\end{aligned}

But when it tried to created a TeXIcon I got the following NullPointerException:

Exception in thread "main" java.lang.NullPointerException
        at org.scilab.forge.jlatexmath.MatrixAtom.createBox(MatrixAtom.java:364)
        at org.scilab.forge.jlatexmath.TeXFormula.createBox(TeXFormula.java:386)
        at org.scilab.forge.jlatexmath.TeXFormula.createTeXIcon(TeXFormula.java:401)
        at embedding.latex.Convert.toSVG(Convert.java:55)
        at embedding.latex.Latex2TIFF.main(LatexConvert.java:68)

After looking into the code I believe I may have a simple fix for it:
Simply change line 286 to 289 in the MatrixAtom class from this
if (w == Float.POSITIVE_INFINITY) {
    arr[0] = nullBox;
    arr[col] = arr[0];
}

To this:
if (w == Float.POSITIVE_INFINITY) {
    arr[0] = nullBox;
    arr[col-1] = arr[0];
    arr[col] = arr[0];
}

Would this fix be acceptable?

Thanks,
Graeme