protection against potential nil object

This commit is contained in:
Gered 2016-05-16 13:51:54 -04:00
parent c8c6d3080d
commit 1008958854

View file

@ -109,7 +109,9 @@
(defn channel-state
"returns the current state of the browserchannel connection."
[]
(get bch-state-enum-to-keyword (.getState (get-channel)) :unknown))
(if-let [channel (get-channel)]
(get bch-state-enum-to-keyword (.getState channel) :unknown)
:closed))
(defn connected?
"returns true if the browserchannel connection is currently connected."