8000 修正 move to bug · HashCoding/boxbot@0cf9330 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0cf9330

Browse files
committed
修正 move to bug
1 parent 96b7721 commit 0cf9330

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

boxbot.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,13 @@ Boxbot.prototype.taskloop = function () {
277277
Boxbot.prototype.search = function (target, algorithm) {
278278
if (this.map.getType(target) = 9B5D = 'null') {
279279
var path = this.finder.search(algorithm || 'dfs', this.bot.getCurrentPosition(), target)
280-
if (path && path.length > 1) {
281-
path.shift()
282-
path.forEach((function (item) {
283-
this.run(this.goto, [item, true])
284-
}).bind(this))
280+
if (path) {
281+
if (path.length > 1) {
282+
path.shift()
283+
path.forEach((function (item) {
284+
this.run(this.goto, [item, true])
285+
}).bind(this))
286+
}
285287
} else {
286288
throw '寻路失败'
287289
}

0 commit comments

Comments
 (0)
0