diff --git a/components/thtmlport/package/htmlmisc.pas b/components/thtmlport/package/htmlmisc.pas index 892f48c4a..f239a9d2c 100755 --- a/components/thtmlport/package/htmlmisc.pas +++ b/components/thtmlport/package/htmlmisc.pas @@ -651,10 +651,14 @@ begin if cchMultiByte < 0 then {Null terminated?} s := lpMultiByteStr else + begin + if lpMultiByteStr = nil then s := '' + else begin - SetLength(s, cchMultiByte); - Move(lpMultiByteStr^, s[1], cchMultiByte); + SetLength(s, cchMultiByte); + Move(lpMultiByteStr^, s[1], cchMultiByte); end; + end; if CodePage = CP_UTF8 then begin w := UTF8Decode(s); diff --git a/components/thtmlport/package/htmlun2.pas b/components/thtmlport/package/htmlun2.pas index cf2995c8c..b0b6a694a 100755 --- a/components/thtmlport/package/htmlun2.pas +++ b/components/thtmlport/package/htmlun2.pas @@ -693,12 +693,11 @@ var ExtS: TSize; Ints: ^Integers; L, H, I: integer; - begin -Extent := 0; -Result := 0; -if (Width <= 0) or (Max = 0) then - Exit; + Extent := 0; + Result := 0; + if (Width <= 0) or (Max = 0) then + Exit; {$IFDEF MSWINDOWS} //Only compile if GetTextExtentExPointW exists if not IsWin32Platform then diff --git a/components/thtmlport/package/styleun.pas b/components/thtmlport/package/styleun.pas index 46fcc9dc5..f43618590 100644 --- a/components/thtmlport/package/styleun.pas +++ b/components/thtmlport/package/styleun.pas @@ -2438,13 +2438,12 @@ if ColorStrings = nil then end; end; -function ColorFromString(S: string; NeedPound: boolean; var Color: TColor): boolean; {Translate StyleSheet color string to Color. If NeedPound is true, a '#' sign is required to preceed a hexidecimal value.} +function ColorFromString(S: string; NeedPound: boolean; var Color: TColor): boolean; const LastS: string = '?&%@'; LastColor: TColor = 0; - var I, Rd, Bl: integer; S1: string;