network: Fix a possible crash with no active connections

As a precaution, check the return value of get_active_connections to
avoid dereferencing a NULL pointer.

https://bugzilla.redhat.com/show_bug.cgi?id=990196
https://bugzilla.gnome.org/show_bug.cgi?id=707906