Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Error: Cannot read property 'X' Of Null #121

Closed
LostSoul6Years opened this issue Feb 23, 2021 · 1 comment
Closed

Type Error: Cannot read property 'X' Of Null #121

LostSoul6Years opened this issue Feb 23, 2021 · 1 comment

Comments

@LostSoul6Years
Copy link

Error

`
} else { throw e }
^

TypeError: Cannot read property 'x' of null
at isPositionNearPath (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer-pathfinder\index.js:195:40)
at EventEmitter. (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer-pathfinder\index.js:288:9)
at EventEmitter.emit (events.js:315:20)
at WorldSync. (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer\lib\plugins\blocks.js:470:44)
at WorldSync.emit (events.js:315:20)
at WorldSync._emitBlockUpdate (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer\node_modules\prismarine-world\src\worldsync.js:61:10)
at WorldSync.setBlockStateId (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer\node_modules\prismarine-world\src\worldsync.js:150:10)
at updateBlockState (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer\lib\plugins\blocks.js:257:15)
at Client. (C:\Users\jjcde\AppData\Roaming\npm\node_modules\mineflayer\lib\plugins\blocks.js:364:5)
at Client.emit (events.js:315:20)
`

Request

according to mineflayer api:https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#blockupdate-oldblock-newblock
In BlockUpdate function,oldblock can be null
but your plugin does not handle such type of null error
it is suggested that in the isPositionNearPath function,you add null check error first
then everything will be solved
it can be predicted that more errors like this can show up because as i remember some other events also have null parameters
it is strongly recommended to review the code once a while in order to prevent them thereafter

@IceTank
Copy link
Collaborator

IceTank commented May 30, 2022

Thanks has been fixed with #269

@IceTank IceTank closed this as completed May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants