kostub / iosMath

Beautiful math equation rendering on iOS and MacOS
MIT License
1.37k stars 234 forks source link

Crash with empty Line in aligns #89

Open Kamik423 opened 6 years ago

Kamik423 commented 6 years ago
\begin{eqalign}
    a & b \\
\end{eqalign}

Crashes unpreventably and does not yield an error message,

\begin{eqalign}
    a & b \\
      &
\end{eqalign}

Renders correctly.

Error Message:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]'

*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c708706 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000010bd9d031 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010c74842c _CFThrowFormattedException + 194
    3   CoreFoundation                      0x000000010c739cd1 -[__NSArrayM objectAtIndexedSubscript:] + 177
    4   <appnme>                            0x000000010866c585 +[MTMathAtomFactory tableWithEnvironment:rows:error:] + 3733
    5   <appnme>                            0x000000010868307e -[MTMathListBuilder buildTable:firstList:row:] + 1518
    6   <appnme>                            0x0000000108681719 -[MTMathListBuilder atomForCommand:] + 2793
    7   <appnme>                            0x000000010867f1e2 -[MTMathListBuilder buildInternal:stopChar:] + 3874
    8   <appnme>                            0x000000010867e2ac -[MTMathListBuilder buildInternal:] + 60
    9   <appnme>                            0x000000010867e0fd -[MTMathListBuilder build] + 45
    10  <appnme>                            0x00000001086837d3 +[MTMathListBuilder buildFromString:error:] + 115
    11  <appnme>                            0x000000010868f62f -[MTMathUILabel setLatex:] + 143
eheitfield commented 5 years ago

I've had the same issue (with a similar call stack). I've also been able to confirm this bug by crashing a few apps from the App Store that make use of iosMath.