+ if (!names) {
+ // If there's no array and no error, then return an empty array.
+ if (*error == ERROR_SUCCESS)
+ return mono_array_new (domain, mono_defaults.string_class, 0);
+ return NULL;
+ }
+
+ result = mono_array_new (domain, mono_defaults.string_class, names->len);
+ for (i = 0; i < names->len; i++) {
+ mono_array_setref (result, i, mono_string_new (domain, g_ptr_array_index (names, i)));
+ g_free (g_ptr_array_index (names, i));
+ }
+ g_ptr_array_free (names, TRUE);