From 5131f2a4de55c9155c4fc711df2bd803e605e8c4 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 8 Apr 2010 23:30:00 +0000 Subject: [PATCH] Fix "List index out of bounds" in HandlePortableSettings() when Explode adds an empty item onto the end, since r3231. Fixes issue #1838. --- source/helpers.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/helpers.pas b/source/helpers.pas index 59830890..a040a4f6 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -3627,8 +3627,10 @@ begin Content := ReadTextfile(FileName); Lines := Explode(CRLF, Content); for i:=0 to Lines.Count-1 do begin - // Each line has 3 segments: reg path | data type | value + // Each line has 3 segments: reg path | data type | value. Continue if explode finds less or more than 3. Segments := Explode(Delimiter, Lines[i]); + if Segments.Count <> 3 then + continue; KeyPath := RegPath + ExtractFilePath(Segments[0]); Name := ExtractFileName(Segments[0]); DataType := TRegDataType(StrToInt(Segments[1]));