@@ -803,30 +803,36 @@ static void shiphit_record_player_killer(object *killer_objp, player *p)
803803 case OBJ_WEAPON:
804804 p->killer_objtype =OBJ_WEAPON;
805805 p->killer_weapon_index =Weapons[killer_objp->instance ].weapon_info_index ;
806- p->killer_species = Ship_info[Ships[Objects[killer_objp->parent ].instance ].ship_info_index ].species ;
806+ if (killer_objp->parent >= 0 && killer_objp->parent < MAX_OBJECTS) {
807+ p->killer_species = Ship_info[Ships[Objects[killer_objp->parent ].instance ].ship_info_index ].species ;
807808
808- if ( &Objects[killer_objp->parent ] == Player_obj ) {
809- // killed by a missile?
810- if (Weapon_info[p->killer_weapon_index ].subtype == WP_MISSILE){
811- p->flags |= PLAYER_FLAGS_KILLED_SELF_MISSILES;
812- } else {
813- p->flags |= PLAYER_FLAGS_KILLED_SELF_UNKNOWN;
809+ if ( &Objects[killer_objp->parent ] == Player_obj ) {
810+ // killed by a missile?
811+ if (Weapon_info[p->killer_weapon_index ].subtype == WP_MISSILE){
812+ p->flags |= PLAYER_FLAGS_KILLED_SELF_MISSILES;
813+ } else {
814+ p->flags |= PLAYER_FLAGS_KILLED_SELF_UNKNOWN;
815+ }
814816 }
815- }
816817
817- // in multiplayer, record callsign of killer if killed by another player
818- if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent ].flags [Object::Object_Flags::Player_ship]) ) {
819- int pnum;
818+ // in multiplayer, record callsign of killer if killed by another player
819+ if ( (Game_mode & GM_MULTIPLAYER) && ( Objects[killer_objp->parent ].flags [Object::Object_Flags::Player_ship]) ) {
820+ int pnum;
820821
821- pnum = multi_find_player_by_object ( &Objects[killer_objp->parent ] );
822- if ( pnum != -1 ) {
823- strcpy_s (p->killer_parent_name , Net_players[pnum].m_player ->callsign );
822+ pnum = multi_find_player_by_object ( &Objects[killer_objp->parent ] );
823+ if ( pnum != -1 ) {
824+ strcpy_s (p->killer_parent_name , Net_players[pnum].m_player ->callsign );
825+ } else {
826+ nprintf ((" Network" , " Couldn't find player object of weapon for killer of %s\n " , p->callsign ));
827+ }
824828 } else {
825- nprintf (( " Network " , " Couldn't find player object of weapon for killer of %s \n " , p-> callsign ));
829+ strcpy_s (p-> killer_parent_name , Ships[Objects[killer_objp-> parent ]. instance ]. get_display_name ( ));
826830 }
827831 } else {
828- strcpy_s (p->killer_parent_name , Ships[Objects[killer_objp->parent ].instance ].get_display_name ());
832+ p->killer_species = -1 ;
833+ strcpy_s (p->killer_parent_name , " " );
829834 }
835+
830836 break ;
831837
832838 case OBJ_SHOCKWAVE:
0 commit comments