Infinite loop where there wasn't one before (and shouldn't be)

I am having similar problems since switching to the move() boots:

loop:
    bestCoin = None
    maxRating = 0
    coinIndex = 0
    coins = self.findItems()
    
    while coinIndex < len(coins) and coins and self.gold < 150:
        coin = coins[coinIndex]
        if self.distanceTo(coin) < 20:
            rating = coin.value / self.distanceTo(coin)
            if rating > maxRating:
                maxRating = rating
                bestCoin = coin
        coinIndex += 1
    enemy = self.findNearest(self.findEnemies()) 
    if enemy and self.distanceTo(enemy) < 15:
        self.attack(enemy)
    # elif bestCoin and self.isReady("jump"):
    #     self.jumpTo(bestCoin.pos)
    elif bestCoin:
        self.move(bestCoin.pos)
    else:
        pass

using this for generic loot/attack (e.g. treasure grove) and it works fine for a while, then it starts bogging down and then throws the infinite loop or slow code error.