From 2be0cc8aae59cbbd5c2610067b3ed04e6ac1818f Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Sat, 28 Feb 2015 23:15:56 +0000 Subject: [PATCH] * avoid crashes when displaying help with an unsupported system codepage git-svn-id: trunk@30040 - --- compiler/widestr.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/widestr.pas b/compiler/widestr.pas index 51fdd2eb01..add3f952c6 100644 --- a/compiler/widestr.pas +++ b/compiler/widestr.pas @@ -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}