Explorar o código

* fix for crash of textmode IDE when loading CHM index that contains empty tags.

git-svn-id: trunk@20087 -
marco %!s(int64=13) %!d(string=hai) anos
pai
achega
70e6637b9e
Modificáronse 1 ficheiros con 11 adicións e 6 borrados
  1. 11 6
      ide/wchmhwrap.pas

+ 11 - 6
ide/wchmhwrap.pas

@@ -121,6 +121,7 @@ var
     i,j : integer;
     i,j : integer;
     item : TChmSiteMapItem;
     item : TChmSiteMapItem;
     tli: integer;
     tli: integer;
+    s  : String;
 begin
 begin
  result:=false;
  result:=false;
  if floaded then exit;
  if floaded then exit;
@@ -160,12 +161,16 @@ begin
   for i:=0 to findex.items.count-1 do
   for i:=0 to findex.items.count-1 do
     begin
     begin
       item:=findex.items.item[i];
       item:=findex.items.item[i];
-      if (length(item.local)>0) and (item.local[1]<>'/') then
-        tli:=TopicLinks^.AddItem('/'+item.local)
-      else
-        tli:=TopicLinks^.AddItem(item.local);
-      TLI:=EncodeHTMLCtx(ID,TLI+1);
-      IndexEntries^.Insert(NewIndexEntry(  FormatAlias(item.text),ID,TLI));
+      s:=formatalias(item.text);
+      if s<>'' then
+        begin
+          if (length(item.local)>0) and (item.local[1]<>'/') then
+            tli:=TopicLinks^.AddItem('/'+item.local)
+          else
+            tli:=TopicLinks^.AddItem(item.local);
+          TLI:=EncodeHTMLCtx(ID,TLI+1);
+          IndexEntries^.Insert(NewIndexEntry(  FormatAlias(item.text),ID,TLI));
+        end;
     end;
     end;
    {$ifdef wdebug}
    {$ifdef wdebug}
      debugmessageS({$i %file%},'TCHMWrapper: endloadindex ',{$i %line%},'1',0,0);
      debugmessageS({$i %file%},'TCHMWrapper: endloadindex ',{$i %line%},'1',0,0);