Browse Source

* Patch for gettext empty string problem, Mantis 14902

git-svn-id: trunk@14102 -
marco 15 years ago
parent
commit
77fcc27837
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fcl-base/src/gettext.pp

+ 6 - 1
packages/fcl-base/src/gettext.pp

@@ -174,12 +174,17 @@ function TMOFile.Translate(AOrig: PChar; ALen: Integer; AHash: LongWord): String
 var
 var
   idx, incr, nstr: LongWord;
   idx, incr, nstr: LongWord;
 begin
 begin
+  if AHash = $FFFFFFFF then
+  begin
+    Result := '';
+    exit;
+  end;
   idx := AHash mod HashTableSize;
   idx := AHash mod HashTableSize;
   incr := 1 + (AHash mod (HashTableSize - 2));
   incr := 1 + (AHash mod (HashTableSize - 2));
   while True do
   while True do
   begin
   begin
     nstr := HashTable^[idx];
     nstr := HashTable^[idx];
-    if nstr = 0 then
+    if (nstr = 0) or (nstr > StringCount) then
     begin
     begin
       Result := '';
       Result := '';
       exit;
       exit;