Skip to content

Commit 6953949

Browse files
BBpezsgorom1504
andauthored
Fix infinity setTimeout by throwing error (PrismarineJS#3561)
Co-authored-by: Romain Beaumont <[email protected]>
1 parent e974e70 commit 6953949

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/plugins/digging.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function inject (bot) {
2424
digFace = 'auto'
2525
}
2626

27+
const waitTime = bot.digTime(block)
28+
if (waitTime === Infinity) {
29+
throw new Error(`dig time for ${block?.name ?? block} is Infinity`)
30+
}
31+
2732
bot.targetDigFace = 1 // Default (top)
2833

2934
if (forceLook !== 'ignore') {
@@ -127,7 +132,6 @@ function inject (bot) {
127132
location: block.position,
128133
face: bot.targetDigFace // default face is 1 (top)
129134
})
130-
const waitTime = bot.digTime(block)
131135
waitTimeout = setTimeout(finishDigging, waitTime)
132136
bot.targetDigBlock = block
133137
bot.swingArm()

0 commit comments

Comments
 (0)