Fix T73371: Crash caused by wrong logic in NULL pointer check.

This commit is contained in:
Bastien Montagne 2020-02-26 19:22:48 +01:00
parent 9085b7e847
commit 2d423479bd
Notes: blender-bot 2023-02-14 07:31:32 +01:00
Referenced by commit 9e382dd2a3, Fix T74542, T74386: schulpt changes not saving (dyntopo or mutires)
Referenced by issue #74542, Sculpt mode: multires not saving brush strokes
Referenced by issue #74386, Sculpt Changes with Dyntopo Enabled Don't Save
Referenced by issue #73371, Appending Collections to a new empty file and trying to save that file causes Blender to crash [cause identified!]
1 changed files with 5 additions and 8 deletions

View File

@ -238,15 +238,12 @@ bool ED_editors_flush_edits_for_object_ex(Main *bmain,
/* Don't allow flushing while in the middle of a stroke (frees data in use).
* Auto-save prevents this from happening but scripts
* may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
{
char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
if (check_needs_flush && (*needs_flush_ptr == 0)) {
return false;
}
*needs_flush_ptr = 0;
if (!ELEM(NULL, ob->sculpt, ob->sculpt->cache)) {
char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
if (check_needs_flush && (*needs_flush_ptr == 0)) {
return false;
}
*needs_flush_ptr = 0;
/* flush multires changes (for sculpt) */
multires_flush_sculpt_updates(ob);