Check if the pipe array is empty before calling stream_select()

The pipe array is either set to null or is empty occasionally when readStreams() is called. This generates a warning frequently which can cause issues for custom shutdown functions. Adding a check to see if the pipe array is empty should be functionally equivalent without having to generate the error.

Fixes: #9280