<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -118,6 +118,7 @@ import Control.Monad.Reader
 import Prelude hiding (readFile)
 import qualified Data.ByteString.Char8 as B
 import System.FilePath ((&lt;/&gt;))
+import Safe
 
 -- | Happstack handler for a gitit wiki.
 wiki :: Config -&gt; ServerPart Response
@@ -142,7 +143,7 @@ fileServeStrict' :: [FilePath] -&gt; FilePath -&gt; ServerPart Response
 fileServeStrict' ps p = do
   rq &lt;- askRq
   resp &lt;- fileServeStrict ps p
-  if rsCode resp == 404 || last (rqUri rq) == '/'
+  if rsCode resp == 404 || lastNote &quot;fileServeStrict'&quot; (rqUri rq) == '/'
      then mzero  -- pass through if not found or directory index
      else do
        -- turn off compresion filter unless it's text</diff>
      <filename>Network/Gitit.hs</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,7 @@ module Network.Gitit.Config ( getConfigFromOpts
                             , readMimeTypesFile
                             , getDefaultConfig )
 where
+import Safe
 import Network.Gitit.Types
 import Network.Gitit.Server (mimeTypes)
 import Network.Gitit.Framework
@@ -235,7 +236,7 @@ fromQuotedMultiline = unlines . map doline . lines . dropWhile (`elem` &quot; \t\n&quot;)
 readNumber :: (Read a) =&gt; String -&gt; String -&gt; a
 readNumber opt &quot;&quot; = error $ opt ++ &quot; must be a number.&quot;
 readNumber opt x  =
-  let x' = case last x of
+  let x' = case lastNote &quot;readNumber&quot; x of
                 'K'  -&gt; init x ++ &quot;000&quot;
                 'M'  -&gt; init x ++ &quot;000000&quot;
                 'G'  -&gt; init x ++ &quot;000000000&quot;</diff>
      <filename>Network/Gitit/Config.hs</filename>
    </modified>
    <modified>
      <diff>@@ -56,6 +56,7 @@ module Network.Gitit.Framework (
                                , filestoreFromConfig
                                )
 where
+import Safe
 import Network.Gitit.Server
 import Network.Gitit.State
 import Network.Gitit.Types
@@ -313,7 +314,7 @@ guardIndex = do
   base &lt;- getWikiBase
   uri' &lt;- liftM rqUri askRq
   let localpath = drop (length base) uri'
-  if length localpath &gt; 1 &amp;&amp; last uri' == '/'
+  if length localpath &gt; 1 &amp;&amp; lastNote &quot;guardIndex&quot; uri' == '/'
      then return ()
      else mzero
 </diff>
      <filename>Network/Gitit/Framework.hs</filename>
    </modified>
    <modified>
      <diff>@@ -53,6 +53,7 @@ module Network.Gitit.Handlers (
                       , feedHandler
                       )
 where
+import Safe
 import Data.FileStore
 import Network.Gitit.Server
 import Network.Gitit.Framework
@@ -666,7 +667,7 @@ fileListToHtml base' prefix files =
                                          href $ if length d == 1
                                                    then base' ++ &quot;/_index&quot;
                                                    else base' ++ joinPath d] &lt;&lt;
-                  last d, accum]) noHtml updirs
+                  lastNote &quot;fileListToHtml&quot; d, accum]) noHtml updirs
   in uplink +++ ulist ! [theclass &quot;index&quot;] &lt;&lt; map fileLink files
 
 -- NOTE:  The current implementation of categoryPage does not go via the</diff>
      <filename>Network/Gitit/Handlers.hs</filename>
    </modified>
    <modified>
      <diff>@@ -98,7 +98,7 @@ Library
     exposed-modules: Network.Gitit.Interface
     build-depends:   ghc, ghc-paths
     cpp-options:     -D_PLUGINS
-  build-depends:     base &gt;= 3, pandoc &gt;= 1.1, filepath
+  build-depends:     base &gt;= 3, pandoc &gt;= 1.1, filepath, safe
   ghc-options:       -Wall
   ghc-prof-options:  -auto-all -caf-all
 </diff>
      <filename>gitit.cabal</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>965336a5284c23caca7ac5f9625ecaee9f1b3546</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Hartman</name>
    <email>thomas@modernfeed.com</email>
  </author>
  <url>http://github.com/jgm/gitit/commit/85d15a6d1ee00c63ca1cf0b7337e8ab21a7aef26</url>
  <id>85d15a6d1ee00c63ca1cf0b7337e8ab21a7aef26</id>
  <committed-date>2009-10-24T09:19:04-07:00</committed-date>
  <authored-date>2009-10-24T09:19:04-07:00</authored-date>
  <message>safify, replace unsafe last last with lastNote, which at least gives a meaningful error message</message>
  <tree>f53985724644d79aba8c15d68233e93d50b9aa80</tree>
  <committer>
    <name>Thomas Hartman</name>
    <email>thomas@modernfeed.com</email>
  </committer>
</commit>
