thtmlport: Fixes a crash

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1922 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-09-08 07:41:21 +00:00
parent 6c5f8322b2
commit 06530a1991
3 changed files with 11 additions and 9 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;