OSDN Git Service

・壊れたお気に入りを読んでも他のお気に入りに影響が出ないようになった。
authoryoffy <yoffy>
Mon, 24 Nov 2003 14:21:22 +0000 (14:21 +0000)
committeryoffy <yoffy>
Mon, 24 Nov 2003 14:21:22 +0000 (14:21 +0000)
Favorite.pas

index cdd6670..3482f44 100644 (file)
@@ -4,7 +4,7 @@ interface
 
 uses
        Messages, SysUtils, Classes, Contnrs, ComCtrls, {HttpApp,} YofUtils,
-       GikoSystem{, XMLIntf, XMLDoc}, GikoXMLDoc, BoardGroup;
+       GikoSystem{, XMLIntf, XMLDoc}, GikoXMLDoc, BoardGroup, windows;
        {SAX, SAXHelpers, SAXComps, SAXKW;}
 
 type
@@ -294,48 +294,53 @@ begin
                if FStack.Count <> 0 then
                        FStack.Pop;
        end else if Node.NodeName = 'favitem' then begin
-               ParentNode := FStack.Peek;
-               if TObject(ParentNode.Data) is TFavoriteFolder then begin
-                       if Node.Attributes['favtype'] = 'board' then begin
-                               // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
-                               if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
-                                       board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
-                                       FavBoard := TFavoriteBoardItem.Create(
-                                               board.URL, Node.Attributes[ 'title' ], board );
-                               end else begin
-                                       FavBoard := TFavoriteBoardItem.Create(
-                                               Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], board );
-                               end;
-                               CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavBoard);
-                               CurrentNode.ImageIndex := 15;
-                               CurrentNode.SelectedIndex := 15;
-                       end else if Node.Attributes['favtype'] = 'thread' then begin
-                               // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
-                               if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
-                                       board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
-                                       if board = nil then
-                                               Exit;
-
-                                       if not board.IsThreadDatRead then
-                                               GikoSys.ReadSubjectFile( board );
-                                       threadItem := board.Find( Node.Attributes[ 'thread' ] );
-                                       if threadItem = nil then begin
-                                               threadItem := TThreadItem.Create(
-                                                       board.BoardPlugIn,
-                                                       GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) );
-                                               threadItem.Title := Node.Attributes[ 'title' ];
-                                               board.Add( threadItem );
+               try
+                       ParentNode := FStack.Peek;
+                       if TObject(ParentNode.Data) is TFavoriteFolder then begin
+                               if Node.Attributes['favtype'] = 'board' then begin
+                                       // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
+                                       if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
+                                               board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
+                                               if board <> nil then
+                                                       FavBoard := TFavoriteBoardItem.Create(
+                                                               board.URL, Node.Attributes[ 'title' ], board );
+                                       end else begin
+                                               FavBoard := TFavoriteBoardItem.Create(
+                                                       Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], board );
                                        end;
-                                       FavThread := TFavoriteThreadItem.Create(
-                                               threadItem.URL, Node.Attributes[ 'title' ], threadItem );
-                               end else begin
-                                       FavThread := TFavoriteThreadItem.Create(
-                                               Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], threadItem );
+                                       CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavBoard);
+                                       CurrentNode.ImageIndex := 15;
+                                       CurrentNode.SelectedIndex := 15;
+                               end else if Node.Attributes['favtype'] = 'thread' then begin
+                                       // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
+                                       if Length( Node.Attributes[ 'bbs' ] ) > 0 then begin
+                                               board := BBSsFindBoardFromBBSID( Node.Attributes[ 'bbs' ] );
+                                               if board = nil then
+                                                       Exit;
+
+                                               if not board.IsThreadDatRead then
+                                                       GikoSys.ReadSubjectFile( board );
+                                               threadItem := board.Find( Node.Attributes[ 'thread' ] );
+                                               if threadItem = nil then begin
+                                                       threadItem := TThreadItem.Create(
+                                                               board.BoardPlugIn,
+                                                               GikoSys.Get2chBoard2ThreadURL( board, ChangeFileExt( Node.Attributes[ 'thread' ], '' ) ) );
+                                                       threadItem.Title := Node.Attributes[ 'title' ];
+                                                       board.Add( threadItem );
+                                               end;
+                                               FavThread := TFavoriteThreadItem.Create(
+                                                       threadItem.URL, Node.Attributes[ 'title' ], threadItem );
+                                       end else begin
+                                               FavThread := TFavoriteThreadItem.Create(
+                                                       Node.Attributes[ 'url' ], Node.Attributes[ 'title' ], threadItem );
+                                       end;
+                                       CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavThread);
+                                       CurrentNode.ImageIndex := 16;
+                                       CurrentNode.SelectedIndex := 16;
                                end;
-                               CurrentNode := FTreeView.Items.AddChildObject(ParentNode, Node.Attributes['title'], FavThread);
-                               CurrentNode.ImageIndex := 16;
-                               CurrentNode.SelectedIndex := 16;
                        end;
+               except
+                       // \82±\82Ì\83A\83C\83e\83\80\82Å\96â\91è\82ª\8bN\82«\82Ä\82à\91¼\82Ì\83A\83C\83e\83\80\82É\89e\8b¿\82ð\97^\82¦\82½\82­\82È\82¢\82Ì\82Å
                end;
        end;
 end;