[Bf-blender-cvs] [8b073594d94] modifier-panels-ui: Don't lower the active modifier index past 0
Hans Goudey
noreply at git.blender.org
Thu Apr 2 19:59:34 CEST 2020
Commit: 8b073594d945f670959a63da7fe762d1686dd34b
Author: Hans Goudey
Date: Thu Apr 2 10:50:06 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB8b073594d945f670959a63da7fe762d1686dd34b
Don't lower the active modifier index past 0
===================================================================
M source/blender/editors/object/object_modifier.c
===================================================================
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 3557a6eda24..37e361f111c 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -400,7 +400,8 @@ bool ED_object_modifier_remove(ReportList *reports, Main *bmain, Object *ob, Mod
}
/* Lower the active index so it isn't out of bounds. */
- ob->active_mod_index = min_ii(ob->active_mod_index, BLI_listbase_count(&ob->modifiers) - 1);
+ int modifiers_len = BLI_listbase_count(&ob->modifiers);
+ ob->active_mod_index = (modifiers_len > 0) ? min_ii(ob->active_mod_index, modifiers_len - 1) : 0;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
DEG_relations_tag_update(bmain);
More information about the Bf-blender-cvs
mailing list