Skip to content

Commit

Permalink
Update entities.js
Browse files Browse the repository at this point in the history
Adding if statement around entity.type = entityData.type || 'object' to fix "TypeError: Cannot read properties of undefined (reading 'type')"
  • Loading branch information
Mykola1453 authored Dec 27, 2023
1 parent 70a652e commit cb7ff54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugins/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ function inject (bot) {
const entity = fetchEntity(packet.entityId)
const entityData = bot.registry.entities[packet.type]

entity.type = entityData.type || 'object'
if (entityData) {
entity.type = entityData.type || 'object'
}
setEntityData(entity, packet.type, entityData)

if (bot.supportFeature('fixedPointPosition')) {
Expand Down

0 comments on commit cb7ff54

Please sign in to comment.