From 3d36ac460192cc2e0a95f33c2ef102ce1da97cab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Garc=C3=ADa?=
 <dani-garcia@users.noreply.github.com>
Date: Wed, 21 Nov 2018 15:07:18 +0100
Subject: [PATCH] Remove unwrap in connection_lost

---
 src/api/notifications.rs | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/api/notifications.rs b/src/api/notifications.rs
index d5707f0c..7103bdff 100644
--- a/src/api/notifications.rs
+++ b/src/api/notifications.rs
@@ -219,7 +219,6 @@ impl Factory for WSFactory {
     type Handler = WSHandler;
 
     fn connection_made(&mut self, out: Sender) -> Self::Handler {
-        println!("WS: Connection made");
         WSHandler {
             out,
             user_uuid: None,
@@ -228,12 +227,11 @@ impl Factory for WSFactory {
     }
 
     fn connection_lost(&mut self, handler: Self::Handler) {
-        println!("WS: Connection lost");
-
         // Remove handler
-        let user_uuid = &handler.user_uuid.unwrap();
-        if let Some(mut user_conn) = self.users.map.get_mut(user_uuid) {
-            user_conn.remove_item(&handler.out);
+        if let Some(user_uuid) = &handler.user_uuid {
+            if let Some(mut user_conn) = self.users.map.get_mut(user_uuid) {
+                user_conn.remove_item(&handler.out);
+            }
         }
     }
 }