* avoid crashes when displaying help with an unsupported system codepage

git-svn-id: trunk@30040 -
This commit is contained in:
Tomas Hajny 2015-02-28 23:15:56 +00:00
parent dbbce18f56
commit 2be0cc8aae

View File

@ -393,14 +393,16 @@ unit widestr;
end;
Result := J;
end
else
else if CPAvailable (DefaultSystemCodepage) then
begin
GetMem (P2, Succ (L));
FillChar (P2^, Succ (L), 0);
ChangeCodePage (P, L, DefaultSystemCodepage, P2, 28591);
Result := StrLen (P2);
FreeMem (P2, Succ (L));
end;
end
else
Result := L;
{$ELSE FPC_HAS_CPSTRING}
Result := L;
{$ENDIF FPC_HAS_CPSTRING}