Prechádzať zdrojové kódy

* add missing condition for empty string in Unicode uppercase and lowercase conversion routines

git-svn-id: trunk@29625 -
Tomas Hajny 10 rokov pred
rodič
commit
5a56228011
1 zmenil súbory, kde vykonal 10 pridanie a 7 odobranie
  1. 10 7
      rtl/os2/sysucode.inc

+ 10 - 7
rtl/os2/sysucode.inc

@@ -1221,8 +1221,9 @@ var
   I: cardinal;
 begin
   SetLength (Result, Length (S));
-  for I := 0 to Pred (Length (S)) do
-   PWideChar (Result) [I] := Sys_UniToUpper (S [Succ (I)]);
+  if Length (S) > 0 then
+   for I := 0 to Pred (Length (S)) do
+    PWideChar (Result) [I] := Sys_UniToUpper (S [Succ (I)]);
 end;
 
 
@@ -1231,8 +1232,9 @@ var
   I: cardinal;
 begin
   SetLength (Result, Length (S));
-  for I := 0 to Pred (Length (S)) do
-   PWideChar (Result) [I] := Sys_UniToLower (S [Succ (I)]);
+  if Length (S) > 0 then
+   for I := 0 to Pred (Length (S)) do
+    PWideChar (Result) [I] := Sys_UniToLower (S [Succ (I)]);
 end;
 
 
@@ -1242,9 +1244,10 @@ var
 begin
   Result := S;
   UniqueString (Result);
-  for I := 1 to Length (S) do
-   if Result [I] = WNull then
-    Result [I] := ' ';
+  if Length (S) > 0 then
+   for I := 1 to Length (S) do
+    if Result [I] = WNull then
+     Result [I] := ' ';
 end;