The documentation for this function suggests that it can handle invalid descriptors safely. This change allows negative descriptors to be handled without a crash.