diff options
author | Bastien Montagne <bastien@blender.org> | 2022-02-18 14:11:59 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-02-18 14:29:27 +0300 |
commit | 02f4d63dcc7b74fbacfb4e5bcdd01766563573f5 (patch) | |
tree | 3c5a9cdb97746bb506ac7f584ff782c518b0d1bb /source/blender/blenloader | |
parent | 8b4da9a191b9a35c743209d38c99c000f8490501 (diff) |
Fix broken shapekeys: check for 'NULL' `from` pointer too.
Add check for `NULL` `from` pointer to `BLO_main_validate_shapekeys`,
and delete these shapekeys, as they are fully invalid and impossible to
recover.
Found in a studio production file (`animation
test/snow_parkour/shots/0040/0040.lighting.blend`, svn rev `1111`).
Would be nice to know how this was generated too...
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/blend_validate.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index 333f6e341c6..c8dd27f0c9c 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -195,5 +195,20 @@ bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports) BKE_main_unlock(bmain); + /* NOTE: #BKE_id_delete also locks `bmain`, so we need to do this loop outside of the lock here. + */ + LISTBASE_FOREACH_MUTABLE (Key *, shapekey, &bmain->shapekeys) { + if (shapekey->from != NULL) { + continue; + } + + BKE_reportf(reports, + RPT_ERROR, + "Shapekey %s has an invalid 'from' pointer (%p), it will be deleted", + shapekey->id.name, + shapekey->from); + BKE_id_delete(bmain, shapekey); + } + return is_valid; } |