summaryrefslogtreecommitdiff
path: root/Utility/WebApp.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-05 15:08:58 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-05 15:10:26 -0400
commitac71ab7bd7dded89202fde4a1f725dac32c7cd3c (patch)
tree4c4a02715ea00eaf015597593d837858ce077a4b /Utility/WebApp.hs
parent0833eb43a6ab3cd74c8c9fc77d235fd5644ac555 (diff)
avoid head
Diffstat (limited to 'Utility/WebApp.hs')
-rw-r--r--Utility/WebApp.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs
index 971422e36..be186baa2 100644
--- a/Utility/WebApp.hs
+++ b/Utility/WebApp.hs
@@ -67,7 +67,9 @@ runWebApp app observer = do
localSocket :: IO Socket
localSocket = do
addrs <- getAddrInfo (Just hints) (Just localhost) Nothing
- go $ Prelude.head addrs
+ case addrs of
+ [] -> error "unable to bind to a local socket"
+ (addr:_) -> go addr
where
hints = defaultHints
{ addrFlags = [AI_ADDRCONFIG]