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


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

  \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}} \\ 

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(
        at org.scilab.forge.jlatexmath.TeXFormula.createBox(
        at org.scilab.forge.jlatexmath.TeXFormula.createTeXIcon(
        at embedding.latex.Convert.toSVG(
        at embedding.latex.Latex2TIFF.main(

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?