Fixed a bug causing gcodeInterpreter to hiccup on GCODES containing invalid coordinates such as Xnan or Yinf, causing in turn the file API to fail until the offending file was deleted and its metadata removed

This commit is contained in:
Gina Häußge 2015-02-01 17:27:12 +01:00 committed by Teja
parent 2800f53448
commit 21dd31b0fd

View file

@ -265,13 +265,16 @@ def getCodeInt(line, code):
def getCodeFloat(line, code):
import math
n = line.find(code) + 1
if n < 1:
return None
m = line.find(' ', n)
try:
if m < 0:
return float(line[n:])
return float(line[n:m])
val = float(line[n:])
else:
val = float(line[n:m])
return val if not (math.isnan(val) or math.isinf(val)) else None
except:
return None