Skip to content

Commit

Permalink
Merge pull request #1801 from SmartThingsCommunity/bugfix/CHAD-12274
Browse files Browse the repository at this point in the history
CHAD-12274 fixes occasional null pointer
  • Loading branch information
greens authored Dec 6, 2024
2 parents 802a03a + 43bdeb7 commit 7afec24
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/SmartThings/zigbee-switch/src/preferences.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ preferences.update_preferences = function(driver, device, args)
local prefs = preferences.get_device_parameters(device)
if prefs ~= nil then
for id, value in pairs(device.preferences) do
if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then
if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then
local message = prefs[id](device, value)
device:send(message)
end
Expand Down
2 changes: 1 addition & 1 deletion drivers/SmartThings/zwave-sensor/src/preferences.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ preferences.update_preferences = function(driver, device, args)
local prefs = preferences.get_device_parameters(device)
if prefs ~= nil then
for id, value in pairs(device.preferences) do
if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then
if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then
local new_parameter_value = preferences.to_numeric_value(device.preferences[id])
device:send(Configuration:Set({parameter_number = prefs[id].parameter_number, size = prefs[id].size, configuration_value = new_parameter_value}))
end
Expand Down
2 changes: 1 addition & 1 deletion drivers/SmartThings/zwave-smoke-alarm/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local preferencesMap = require "preferences"
local function update_preferences(self, device, args)
local preferences = preferencesMap.get_device_parameters(device)
for id, value in pairs(device.preferences) do
if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and preferences and preferences[id]) then
if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and preferences and preferences[id]) then
local new_parameter_value = preferencesMap.to_numeric_value(device.preferences[id])
device:send(Configuration:Set({parameter_number = preferences[id].parameter_number, size = preferences[id].size, configuration_value = new_parameter_value}))
end
Expand Down

0 comments on commit 7afec24

Please sign in to comment.