Fix infinite loop when writing code at end of file
This resulted in my BBEdit hanging.
This commit is contained in:
4
rust.mm
4
rust.mm
@@ -569,7 +569,7 @@ OSErr calculateRuns(BBLMParamBlock ¶ms, const BBLMCallbackBlock *callbacks)
|
||||
bool wordchr = false;
|
||||
while ((ch = iter.GetNextChar()))
|
||||
{
|
||||
if (ch == 'r' && iter.strcmp("##\"", 3) == 0)
|
||||
if (ch == 'r' && iter.CharsLeft() >= 3 && iter.strcmp("##\"", 3) == 0)
|
||||
{
|
||||
iter--;
|
||||
if (!makeCodeRun(iter, runStart, *callbacks)) return noErr;
|
||||
@@ -675,7 +675,7 @@ OSErr calculateRuns(BBLMParamBlock ¶ms, const BBLMCallbackBlock *callbacks)
|
||||
iter--;
|
||||
}
|
||||
}
|
||||
else if (ch == 'a' && iter.strcmp("cro_rules!", 10) == 0)
|
||||
else if (ch == 'a' && iter.CharsLeft() >= 10 && iter.strcmp("cro_rules!", 10) == 0)
|
||||
{
|
||||
iter += 10;
|
||||
ch = iter.GetNextChar();
|
||||
|
||||
Reference in New Issue
Block a user