Skip to content

Commit fd082c3

Browse files
committed
fix(#94): Check version existence before updating content
Adds a check to ensure the latest version exists for the given language before attempting to update the page data. This prevents errors when the version does not exist.
1 parent 4472b1d commit fd082c3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

commands/clean/content.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@
4343
$data[$originalField] = null;
4444
}
4545

46-
// try to update the page with the data
47-
$item->version('latest')->update($data, $lang);
46+
// get the latest version of the item
47+
$version = $item->version('latest');
48+
49+
// check if the version exists for the given language
50+
// and try to update the page with the data
51+
if ($version->exists($lang) === true) {
52+
$version->update($data, $lang);
53+
}
4854
}
4955
}
5056
};

0 commit comments

Comments
 (0)