Skip to content

Commit

Permalink
Merge pull request #80 from dhalbert/initial-value-none
Browse files Browse the repository at this point in the history
check initial_value is explicitly None
  • Loading branch information
tannewt authored Apr 20, 2020
2 parents 6babdd2 + ed5cf93 commit 96774b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adafruit_ble/characteristics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def __init__(
):
self._struct_format = struct_format
self._expected_size = struct.calcsize(struct_format)
if initial_value:
if initial_value is not None:
initial_value = struct.pack(self._struct_format, *initial_value)
super().__init__(
uuid=uuid,
Expand Down
2 changes: 1 addition & 1 deletion adafruit_ble/characteristics/float.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
write_perm=Attribute.OPEN,
initial_value=None
):
if initial_value:
if initial_value is not None:
initial_value = (initial_value,)
super().__init__(
"<f",
Expand Down
2 changes: 1 addition & 1 deletion adafruit_ble/characteristics/int.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
):
self._min_value = min_value
self._max_value = max_value
if initial_value:
if initial_value is not None:
if not self._min_value <= initial_value <= self._max_value:
raise ValueError("initial_value out of range")
initial_value = (initial_value,)
Expand Down

0 comments on commit 96774b1

Please sign in to comment.