Procházet zdrojové kódy

Fixed a possible pet server crash (#3912)

Thanks to @functor-x
Lemongrass3110 před 6 roky
rodič
revize
dd08423484
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      src/map/npc.cpp

+ 5 - 0
src/map/npc.cpp

@@ -2061,6 +2061,11 @@ uint8 npc_selllist(struct map_session_data* sd, int n, unsigned short *item_list
 		idx    = item_list[i*2]-2;
 		amount = item_list[i*2+1];
 
+		// Forged packet, we do not care if he loses items
+		if( sd->inventory_data[idx] == nullptr ){
+			return 1;
+		}
+
 		if( sd->inventory_data[idx]->type == IT_PETEGG && sd->inventory.u.items_inventory[idx].card[0] == CARD0_PET )
 		{
 			if( pet_db_search(sd->inventory.u.items_inventory[idx].nameid, PET_EGG) )