SparkFun_APDS-9960_Sensor_Arduino_Library
SparkFun_APDS-9960_Sensor_Arduino_Library copied to clipboard
Possible divide by 0 error
Ratios in line 837 could possibly cause divide by 0 error if bounds check fails (line 785). Add a check beforehand to prevent this:
/* Catch to make sure we don't divide by 0 */
if( ((u_first + d_first) == 0) ||
((l_first + r_first) == 0) ||
((u_last + d_last) == 0) ||
((l_last + r_last) == 0) ) {
return false;
}