[RESEND PATCH v2] thermal: Fix a NULL pointer dereference