Closed fedegiova closed 5 years ago
Yes, I got it, but the code before was:
ret->precip_today = (atof(val) * 100.0);
with previp_today of type short. If Wunderground in a day without rain returns precipin = -999, then -999 * 100 < -65534 --> underflow
I've changed it to perform the check for negative values before the multiplication
float v = str_to_float(val,0); if( v < 0) v = 0; ret->precip_today = v * 100;
obsolete since wunderground no longer functions
The Wunderground API returns ( at least for me ) precipin = -999 and precip_today_in = -999 in day without rain causing the adjustment factor to overflow the short int storage