cpuidle: add checks to avoid NULL pointer dereference