Skip to content

Commit

Permalink
no error on parse failure
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Oct 13, 2024
1 parent 49c96d0 commit 23373c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/lib/mqtt_messages_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def handle_readings(topic, message, retry_on_nil_device)
device = find_device_for_topic(topic, message, retry_on_nil_device)
return nil if device.nil?

data = JSON.parse(message)["data"] if message
parsed = JSON.parse(message) if message
data = parsed["data"] if parsed
return nil if data.nil? or data&.empty?

data.each do |reading|
Expand Down

0 comments on commit 23373c3

Please sign in to comment.