From 0bf26b8e905e2685c92e8eef4d9cdd9fcf5c49c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 9 May 2017 16:20:58 -0400 Subject: Avoid crash when --use-server is given an url that does not include a path. --- WebSockets.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'WebSockets.hs') diff --git a/WebSockets.hs b/WebSockets.hs index 359fe7b..2a0eb40 100644 --- a/WebSockets.hs +++ b/WebSockets.hs @@ -144,7 +144,9 @@ runClientApp serverurl app = do port = case uriPort serverauth of (':':s) -> fromMaybe 80 (readMaybe s) _ -> 80 - endpoint = uriPath serverurl + endpoint = case uriPath serverurl of + [] -> "/" + p -> p catchconnclosed ConnectionClosed = Just () catchconnclosed _ = Nothing -- cgit v1.2.3