(player_new): Proper error checking. Oops, now it may return NULL.

Proper error checking in callers required.
(update_wait, market_update): If player_new() returns null pointer,
skip update.
(player_accept): If player_new() returns null pointer, close
connection.
This commit is contained in:
Markus Armbruster 2004-01-23 13:44:19 +00:00
parent f841200923
commit 632fbf8d12
3 changed files with 25 additions and 6 deletions

View file

@ -77,8 +77,12 @@ void *argv;
time(&now);
/* logerror("Checking the world markets at %s", ctime(&now));*/
dp = player_new(0, 0);
empth_create(PP_UPDATE, check_all_markets, (50 * 1024), 0,
"MarketCheck", "Checks the world markets", dp);
if (dp) {
empth_create(PP_UPDATE, check_all_markets, (50 * 1024), 0,
"MarketCheck", "Checks the world markets", dp);
} else {
logerror("can't create dummy player for market update");
}
now = now + 300; /* Every 5 minutes */
empth_sleep(now);
}