]> git.rkrishnan.org Git - functorrent.git/commitdiff
Metainfo: Info may or may not be present
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 25 Jul 2017 07:25:20 +0000 (12:55 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 25 Jul 2017 07:25:20 +0000 (12:55 +0530)
src/FuncTorrent/Metainfo.hs

index 13e7979644c085b3b3778cad9478f81e5bbd9036..e555074ac110076f675462ae133434ed183a39f4 100644 (file)
@@ -41,7 +41,7 @@ data Info = Info { pieceLength :: !Integer
                  , md5sum :: !(Maybe String)
                  } deriving (Eq, Show)
 
-data Metainfo = Metainfo { info :: !Info
+data Metainfo = Metainfo { info :: !(Maybe Info)
                          , announceList :: ![String]
                          , creationDate :: !(Maybe Integer)
                          , comment :: !(Maybe String)
@@ -67,7 +67,7 @@ mkInfo _ = Nothing
 
 mkMetaInfo :: BVal   -> Either String Metainfo
 mkMetaInfo (Bdict m)  =
-    let (Just info')  = mkInfo $ m ! "info"
+    let info'         = mkInfo $ m ! "info"
         announce'     = lookup "announce" m
         announceList' = lookup "announce-list" m
         creationDate' = lookup "creation date" m