Fix crash when there is no active network connection.