-fixed broken gamercards, broke in one of the laster revs

This commit is contained in:
fix94.1 2012-02-23 19:08:34 +00:00
parent 4d9cba851c
commit 02ea975071

View File

@ -19,10 +19,9 @@ int amount_of_providers = 0;
u8 register_card_provider(const char *url, const char *key) u8 register_card_provider(const char *url, const char *key)
{ {
struct provider *new_providers = (struct provider *) realloc(providers, (amount_of_providers + 1) * sizeof(struct provider)); if (strlen(url) > 0 && strlen(key) > 0)
if (new_providers != NULL && strlen(url) > 0 && strlen(key) > 0)
{ {
providers = new_providers; providers = (struct provider *) realloc(providers, (amount_of_providers + 1) * sizeof(struct provider));;
memset(&providers[amount_of_providers], 0, sizeof(struct provider)); memset(&providers[amount_of_providers], 0, sizeof(struct provider));
strncpy((char *) providers[amount_of_providers].url, url, 128); strncpy((char *) providers[amount_of_providers].url, url, 128);
strncpy((char *) providers[amount_of_providers].key, key, 48); strncpy((char *) providers[amount_of_providers].key, key, 48);
@ -40,9 +39,7 @@ u8 has_enabled_providers()
for (i = 0; i < amount_of_providers && providers != NULL; i++) for (i = 0; i < amount_of_providers && providers != NULL; i++)
{ {
if (strlen(providers[i].url) > 0 && strlen(providers[i].key) > 0) if (strlen(providers[i].url) > 0 && strlen(providers[i].key) > 0)
{
return 1; return 1;
}
} }
return 0; return 0;
} }