fix, AV in string ranges

This commit is contained in:
Basile Burg 2016-03-19 00:05:35 +01:00
parent 1bd6099f10
commit cea5cf757b
3 changed files with 13 additions and 3 deletions

View File

@ -24,7 +24,7 @@ inherited CEMessagesWidget: TCEMessagesWidget
Width = 759
Align = alClient
BorderSpacing.Around = 2
DefaultItemHeight = 18
DefaultItemHeight = 16
Font.Height = -12
Font.Name = 'Courier New'
Font.Quality = fqProof

View File

@ -1002,6 +1002,8 @@ begin
rng.init(aMessg);
while true do
begin
if rng.empty then
break;
idt := rng.popUntil(alp)^.takeWhile(alp).yield;
if idt = '' then
exit;
@ -1017,11 +1019,14 @@ var
lne: string;
col: string = '';
begin
Result := Point(-1,-1);
if aMessage.isEmpty then
exit;
rng.init(aMessage);
rng.popUntil(['('])^.popWhile(['(']);
rng.popUntil('(')^.popWhile('(');
lne := rng.takeUntil([',', ':', ')']).yield;
if rng.front in [',', ':'] then
col := rng.popWhile([',', ':'])^.takeUntil([')']).yield;
col := rng.popWhile([',', ':'])^.takeUntil(')').yield;
result.y := strToIntDef(lne, -1);
result.x := strToIntDef(col, -1);
end;

View File

@ -97,6 +97,11 @@ end;
function TStringRange.init(const str: string): PStringRange;
begin
ptr := nil;
pos := 0;
len := 0;
if str = '' then
exit;
ptr := @str[1];
pos := 0;
len := length(str);