1313registries_t registry_manager_init_registries (list_t * registry_urls , clib_secrets_t secrets ) {
1414 list_t * registries = list_new ();
1515
16- // Add all the registries that were provided.
17- list_iterator_t * registry_iterator = list_iterator_new (registry_urls , LIST_HEAD );
18- list_node_t * node ;
19- while ((node = list_iterator_next (registry_iterator ))) {
20- char * url = node -> val ;
21- url_data_t * parsed = url_parse (url );
22- char * hostname = strdup (parsed -> hostname );
23- url_free (parsed );
24- char * secret = clib_secret_find_for_hostname (secrets , hostname );
25- registry_ptr_t registry = registry_create (url , secret );
26- list_rpush (registries , list_node_new (registry ));
16+ if (registry_urls != NULL ) {
17+ // Add all the registries that were provided.
18+ list_iterator_t * registry_iterator = list_iterator_new (registry_urls , LIST_HEAD );
19+ list_node_t * node ;
20+ while ((node = list_iterator_next (registry_iterator ))) {
21+ char * url = node -> val ;
22+ url_data_t * parsed = url_parse (url );
23+ char * secret = clib_secret_find_for_hostname (secrets , parsed -> hostname );
24+ url_free (parsed );
25+ registry_ptr_t registry = registry_create (url , secret );
26+ if (registry != NULL ) {
27+ list_rpush (registries , list_node_new (registry ));
28+ }
29+ }
30+ list_iterator_destroy (registry_iterator );
2731 }
28- list_iterator_destroy (registry_iterator );
2932
3033 // And add the default registry.
3134 registry_ptr_t registry = registry_create (CLIB_WIKI_URL , NULL );
@@ -45,7 +48,7 @@ void registry_manager_fetch_registries(registries_t registries) {
4548 registry_iterator_destroy (it );
4649}
4750
48- registry_package_ptr_t registry_manger_find_package (registries_t registries , const char * package_id ) {
51+ registry_package_ptr_t registry_manager_find_package (registries_t registries , const char * package_id ) {
4952 registry_iterator_t it = registry_iterator_new (registries );
5053 registry_ptr_t reg ;
5154 while ((reg = registry_iterator_next (it ))) {
0 commit comments