Add empty() check on streams before attempting to stream_select

stream_select was generating the error: 

    stream_select(): No stream arrays were passed 

While this error is suppressed it is still generated which can cause issues for applications with custom shutdown functions. Simply adding a check to see if $r is empty should allow for the same functionality without generating an error.