tidy5e-sheet
tidy5e-sheet copied to clipboard
Thousands of errors during dnd5e system migration (game.actors.get(...) is undefined)
I just installed the dnd5e v1.4.3 update, and during the migration I got thousands of errors on the console, e.g...

I have updated the 5e system with the sheet and lib-wrapper active without any issue. Twice. So I'm sorry to say that I don't have a clue what's going on there.
Since this seems to have been an isolated issue that I can't replicate I guess it was something unique to your setup. I'm going to close this issue for now.
I still get thousands of these errors every time I update the dnd5e system. I've tracked it down to when it updates the actors in compendia. The rogue line of code is...
if (game.actors.get(actorEntity.data._id).data.type !== "character")
The actor does not exist in the world, so the game.actors.get() call returns undefined. However I don't think there is any need to call game.actors.get(), you can directly reference actorEntity.data.type, like so...
if (actorEntity.data.type !== "character")
Alternatively, I'm not sure if updateExhaustion() needs to be run on actors in compendia at all. Maybe updateExhausion() should just return if game.actors.get(actorEntity.data._id) returns undefined?
Is this by any chance solved with the update - or maybe solved itself before that?
I did not get these errors on the dnd 2.1 migration, so I assume it is fixed.