commands: return none, when offset exceeds file length
The computed length of the file may be negative, when the offset exceeds
the file length. When this is the case, return none
Change-Id: I2c017c620254fae188022851ef3b670730aab503
diff --git a/pySim/commands.py b/pySim/commands.py
index 107f0f5..cea330e 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -155,6 +155,9 @@
return (None, None)
if length is None:
length = self.__len(r) - offset
+ if length < 0:
+ return (None, None)
+
total_data = ''
chunk_offset = 0
while chunk_offset < length: