mirror of https://github.com/kivy/kivy.git
Merge pull request #5593 from skallet/mtdev-division-fix
Fix float division by zero
This commit is contained in:
commit
4c62d76c92
|
@ -220,7 +220,10 @@ else:
|
||||||
queue.append((action, touch))
|
queue.append((action, touch))
|
||||||
|
|
||||||
def normalize(value, vmin, vmax):
|
def normalize(value, vmin, vmax):
|
||||||
return (value - vmin) / float(vmax - vmin)
|
try:
|
||||||
|
return (value - vmin) / float(vmax - vmin)
|
||||||
|
except ZeroDivisionError: # it's both in py2 and py3
|
||||||
|
return (value - vmin)
|
||||||
|
|
||||||
# open mtdev device
|
# open mtdev device
|
||||||
_fn = input_fn
|
_fn = input_fn
|
||||||
|
|
Loading…
Reference in New Issue