Gestion plus fines des entites et corrections sur initiative #195

This commit is contained in:
sladecraven 2021-11-11 09:25:38 +01:00
parent 0a87c20176
commit d792d736d4
2 changed files with 3 additions and 3 deletions

View File

@ -267,7 +267,7 @@ async function migrationPngWebp_1_5_34() {
return img.replace(regexOldPngJpg, replaceWithWebp);
}
function prepareDocumentsImgUpdate(documents) {
return documents.filter(it => it.img.match(regexOldPngJpg))
return documents.filter(it => it.img && it.img.match(regexOldPngJpg))
.map(it => {
return { _id: it.id, img: convertImgToWebp(it.img) }
});
@ -278,7 +278,7 @@ async function migrationPngWebp_1_5_34() {
await Item.updateDocuments(itemsUpdates);
await Actor.updateDocuments(actorsUpdates);
game.actors.forEach(actor => {
if (actor.data.token.img.match(regexOldPngJpg)){
if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)){
actor.update({ "token.img": convertImgToWebp(actor.data.token.img) });
}
const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items);

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.34",
"version": "1.5.35",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.9",