Skip to content

Commit

Permalink
Cleaner exit on reading 0 bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mundya committed Apr 21, 2015
1 parent 387fc7d commit f0883f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rig/machine_control/machine_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,11 +1467,11 @@ def read(self, n_bytes=-1):
n_bytes = self._end_address - self.address

# Determine how far to read, then read nothing beyond that point.
if self.address + n_bytes >= self._end_address:
if self.address + n_bytes > self._end_address:
n_bytes = min(n_bytes, self._end_address - self.address)

if n_bytes <= 0:
return b''
if n_bytes <= 0:
return b''

# Perform the read and increment the offset
data = self._machine_controller.read(
Expand Down

0 comments on commit f0883f9

Please sign in to comment.