Fixed a rare crash concerning invalid homunculus data and one NULL-pointer.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11075 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-08-24 19:38:38 +00:00
parent 025bcc1f28
commit 3417441a6f

View File

@ -603,7 +603,7 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
i = search_homunculusDB_index(hom->class_,HOMUNCULUS_CLASS);
if(i < 0) {
ShowError("merc_hom_alloc: unknown homunculus class [%d]", hom->class_);
ShowError("merc_hom_alloc: unknown class [%d] for homunculus '%s', requesting deletion.\n", hom->class_, hom->name);
sd->status.hom_id = 0;
intif_homunculus_requestdelete(hom->hom_id);
return 1;
@ -714,8 +714,7 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
merc_hom_alloc(sd, sh);
hd = sd->hd;
if(hd->homunculus.hp && !hd->homunculus.vaporize &&
hd->bl.prev == NULL && sd->bl.prev != NULL)
if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL)
{
map_addblock(&hd->bl);
clif_spawn(&hd->bl);