Skip to content

Commit

Permalink
Safer??? nil checking in #i2c_repeated_start
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Sep 23, 2024
1 parent 4b6498e commit 6a42013
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/denko/i2c/peripheral.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def i2c_frequency

def i2c_repeated_start
return @i2c_repeated_start unless @i2c_repeated_start.nil?
@i2c_repeated_start = params[:i2c_repeated_start] || params[:repeated_start] || i2c_default(:repeated_start)
@i2c_repeated_start = params[:i2c_repeated_start] if @i2c_repeated_start.nil?
@i2c_repeated_start = params[:repeated_start] if @i2c_repeated_start.nil?
@i2c_repeated_start = i2c_default(:repeated_start) if @i2c_repeated_start.nil?
@i2c_repeated_start
end

attr_writer :i2c_frequency, :i2c_repeated_start
Expand Down

0 comments on commit 6a42013

Please sign in to comment.