If the latex is \sqrt only, it will crash on getNextCharacter function call. We modify the sqrt command to check the array index and length by hasCharacters function in MTMathListBuilder.m
- (MTMathAtom*) atomForCommand:(NSString*) command
{
......
} else if ([command isEqualToString:@"sqrt"]) {
// A sqrt command with one argument
MTRadical* rad = [MTRadical new];
if ([self hasCharacters]) {
unichar ch = [self getNextCharacter];
if (ch == '[') {
// special handling for sqrt[degree]{radicand}
rad.degree = [self buildInternal:false stopChar:']'];
rad.radicand = [self buildInternal:true];
} else {
[self unlookCharacter];
rad.radicand = [self buildInternal:true];
}
}
return rad;
If the latex is \sqrt only, it will crash on getNextCharacter function call. We modify the sqrt command to check the array index and length by hasCharacters function in MTMathListBuilder.m
{
......
} else if ([command isEqualToString:@"sqrt"]) {
// A sqrt command with one argument
MTRadical* rad = [MTRadical new];
if ([self hasCharacters]) {
unichar ch = [self getNextCharacter];
if (ch == '[') {
// special handling for sqrt[degree]{radicand}
rad.degree = [self buildInternal:false stopChar:']'];
rad.radicand = [self buildInternal:true];
} else {
[self unlookCharacter];
rad.radicand = [self buildInternal:true];
}
}
return rad;