If I were you I would add a controlled exit based on the error value coming from the sensor, for example:
..
if (!acquire_dht11_sample()) { //HERE you READ the new actual data from sensor - right?
error_condition();
}
// That must be here I think - new read actual data are here (Pito says)
int h_actual = dht11_dat[0]; // Actual humidity value as read by DHT 11 sensor
int t_actual = dht11_dat[2]; // Actual temperature vvalue as read by DHT 11 sensor
if ((t_actual > 80) || (t_actual < 40)) error_condition();
if ((h_actual > 100) || (h_actual <50)) error_condition();
..
And the error condition may do for example:
void error_condition() {
switch_fridge_off();
switch_humid_off();
switch_ERORR_LED_on();
call_national_guard();
while(1){ }; // stop here
}
Also you may add a watchdog - measure the typical duration the fridge motor is running during the operation, and then put into your code a watchdog measuring time the fridge is HIGH - when much longer call error_condition();
etc., etc..