destiny: segfault due to dereferencing nullpointer
get_socket(i) returns NULL, when no specific socket is found.
Without an appropriate check for NULL, the current state
of the code leads to a segfault.

destiny: added parens

destiny: continuing the loop makes more sense than returning at first sight of NULL
Merge pull request #1269 from cgundogan/fix_get_waiting_connection_socket_null_check

destiny: segfault due to dereferencing nullpointer