Skip to content

Commit 8e3bc94

Browse files
committed
fix: guard against potential nil table method call
1 parent e7f9521 commit 8e3bc94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/SmartThings/sonos/src/api/sonos_connection.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ local function _oauth_reconnect_task(sonos_conn)
259259

260260
if unauthorized then
261261
sonos_conn.driver:alert_unauthorized()
262-
local token, channel_error = token_receive_handle:receive()
262+
local token, channel_error =
263+
(token_receive_handle and token_receive_handle:receive()) or nil,
264+
"no token receive handle"
263265
if not token then
264266
log.warn(string.format("Error requesting token: %s", channel_error))
265267
local _, get_token_err = sonos_conn.driver:get_oauth_token()

0 commit comments

Comments
 (0)