Skip to content

Commit ebc2043

Browse files
authored
Fixing Invalid Syntax Crash. (#164)
There is no check for rows count which is unsafe currently. If this is not changed the builder crashes for this example: ``` Pr(H | E) \text{ is the probability that the the hypothesis } H \text{ is true given evidence } E \text{ is true} \\ Pr(H) \text{ is the probability that the hypthesis } H \text{ is true prior to } E \\ Pr(\neg H) \text{ is the probability that } H \text{ is false prior to } E \\ Pr(E\vert H) \text{ is the probability ) E \text{ is true given } H \text{ is true} \\ Pr(E\vert\neg H) \text{ is the probability } E \text{ is true given } H \text{ is false} \\```
1 parent 8a41175 commit ebc2043

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

iosMath/lib/MTMathListBuilder.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,11 @@ - (MTMathAtom*) buildTable:(NSString*) env firstList:(MTMathList*) firstList row
651651
currentCol++;
652652
if (_currentEnv.numRows > currentRow) {
653653
currentRow = _currentEnv.numRows;
654-
rows[currentRow] = [NSMutableArray array];
654+
if (rows.count > currentRow) {
655+
rows[currentRow] = [NSMutableArray array];
656+
} else {
657+
[rows addObject:[NSMutableArray array]];
658+
}
655659
currentCol = 0;
656660
}
657661
}

0 commit comments

Comments
 (0)