From 0ca115e411ebfb1b2452f77e86a2b18db62790a6 Mon Sep 17 00:00:00 2001 From: Marc Fisher Date: Thu, 5 Jan 2017 10:50:43 -0800 Subject: [PATCH] Initialize sessions maps if not set. (#79) --- go/launcher/proxy/driver_hub.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/go/launcher/proxy/driver_hub.go b/go/launcher/proxy/driver_hub.go index f62e5db6..705862d3 100644 --- a/go/launcher/proxy/driver_hub.go +++ b/go/launcher/proxy/driver_hub.go @@ -80,6 +80,9 @@ func (h *WebDriverHub) Name() string { func (h *WebDriverHub) AddSession(id string, session http.Handler) { h.mu.Lock() defer h.mu.Unlock() + if h.sessions == nil { + h.sessions = map[string]http.Handler{} + } h.sessions[id] = session } @@ -87,6 +90,9 @@ func (h *WebDriverHub) AddSession(id string, session http.Handler) { func (h *WebDriverHub) RemoveSession(id string) { h.mu.Lock() defer h.mu.Unlock() + if h.sessions == nil { + h.sessions = map[string]http.Handler{} + } delete(h.sessions, id) }