esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
671 stars 211 forks source link

Event detection: potential division by 0 #61

Open esdalmaijer opened 8 years ago

esdalmaijer commented 8 years ago

Two time stamps are subtracted from each other, and then a distance is divided by the time difference. If the time difference is zero, the result is a crash.

See: https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libeyetribe.py#L967 (and in a few lines around there).

Solution: check whether time has passed, and only proceed if t1-t0 > 0.