Skip to content

Commit

Permalink
[#2934] Fix potential issue with detecting version in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed Feb 17, 2024
1 parent b44f59c commit a146c32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/migration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const migrateWorld = async function() {
try {
const flags = { persistSourceMigration: false };
const source = valid ? actor.toObject() : game.data.actors.find(a => a._id === actor.id);
const version = actor._stats.systemVersion;
let updateData = migrateActorData(source, migrationData, flags);
if ( !foundry.utils.isEmpty(updateData) ) {
console.log(`Migrating Actor document ${actor.name}`);
Expand All @@ -23,7 +24,7 @@ export const migrateWorld = async function() {
}
await actor.update(updateData, {enforceTypes: false, diff: valid && !flags.persistSourceMigration});
}
if ( actor.effects && actor.items && foundry.utils.isNewerVersion("3.0.3", actor._stats.systemVersion) ) {
if ( actor.effects && actor.items && foundry.utils.isNewerVersion("3.0.3", version) ) {
const deleteIds = _duplicatedEffects(actor);
if ( deleteIds.size ) await actor.deleteEmbeddedDocuments("ActiveEffect", Array.from(deleteIds));
}
Expand Down

0 comments on commit a146c32

Please sign in to comment.