Skip to content

Commit

Permalink
fix the data nonetype value bug
Browse files Browse the repository at this point in the history
  • Loading branch information
georgezhao2010 authored Jul 9, 2021
1 parent dbdd344 commit 83f914a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/tencent_stock/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ def __init__(self, coordinator, stock):
or (stock[0:2] == "sz" and stock[2:5] == "399") else False

def get_value(self, key):
data = self._coordinator.data.get(self._stock)
if data is not None:
return data.get(key)
if self._coordinator.data is not None and self._coordinator.data.get(self._stock) is not None:
return self._coordinator.data.get(self._stock).get(key)
else:
return STATE_UNKNOWN

Expand Down

0 comments on commit 83f914a

Please sign in to comment.