Skip to content

Commit da85c05

Browse files
committed
Use getattr to avoid None error
1 parent 0bef2b3 commit da85c05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tesla_fleet_api/tesla/vehicle/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def update(self, sessionInfo: SessionInfo):
183183
self.counter = sessionInfo.counter
184184
self.epoch = sessionInfo.epoch
185185
self.delta = int(time.time()) - sessionInfo.clock_time
186-
if (not self.ready or self.publicKey != sessionInfo.publicKey):
186+
if (not self.ready or getattr(self, "publicKey", "None") != sessionInfo.publicKey):
187187
self.publicKey = sessionInfo.publicKey
188188
self.sharedKey = self.parent.shared_key(sessionInfo.publicKey)
189189
self.hmac = hmac.new(self.sharedKey, "authenticated command".encode(), hashlib.sha256).digest()

0 commit comments

Comments
 (0)