X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/91ef66b5fe0d1c2023f7e43140d8c69260588ac4..6313ac6edd9ede352b1cfa5b6cd29fac79e21e0c:/btime.pas diff --git a/btime.pas b/btime.pas index ae6ffa5..4052493 100644 --- a/btime.pas +++ b/btime.pas @@ -848,19 +848,23 @@ begin if (tzh_timecnt < 0) or (tzh_timecnt > fs) then raise exception.create('tzh_timecnt'); ofs2 := ofs; - for a := 0 to tzh_timecnt -1 do begin - if mode64 then t := getint64 else t := getint; - if (t > ts) then begin - index := a - 1; - break; + if (tzh_timecnt <> 0) then begin + for a := 0 to tzh_timecnt -1 do begin + if mode64 then t := getint64 else t := getint; + if (t > ts) then begin + index := a - 1; + break; + end; + if (a = tzh_timecnt -1) and (ts >= t) then index := a; end; - if (a = tzh_timecnt -1) and (ts >= t) then index := a; - end; - ofs := ofs2 + tzh_timecnt * (1 + ord(mode64)) * 4; + ofs := ofs2 + tzh_timecnt * (1 + ord(mode64)) * 4; - if (cardinal(ofs + index) >= fs) or (index < 0) then raise exception.create('index'); - index := buf[ofs+index]; - inc(ofs,tzh_timecnt); + if (cardinal(ofs + index) >= fs) or (index < 0) then raise exception.create('index'); + index := buf[ofs+index]; + inc(ofs,tzh_timecnt); + end else begin + index := 0; + end; if (index >= tzh_typecnt) then raise exception.create('type'); ofs2 := ofs;