Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-08-30 16:40:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-30 16:41:22 +0300
commit30d900934c4b06c13c65bbf1c9ef34fa14b2c256 (patch)
tree2468bcc562c67075d788d3d9bfaa8281823a4f9f
parenta209681beecdb66ee79cb8b663e357584ec16009 (diff)
UI: assert on invalid click-step for integer buttons
Avoids T69305 going by unnoticed.
-rw-r--r--source/blender/editors/interface/interface.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 66c8eadbd74..0855412bcc4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3586,6 +3586,14 @@ static uiBut *ui_def_but(uiBlock *block,
(a1 != 0.0f && a1 != 1.0f)) == false);
}
+ /* Number buttons must have a click-step,
+ * assert instead of correcting the value to ensure the caller knowns what they're doing. */
+ if ((type & BUTTYPE) == UI_BTYPE_NUM) {
+ if (ELEM((type & UI_BUT_POIN_TYPES), UI_BUT_POIN_CHAR, UI_BUT_POIN_SHORT, UI_BUT_POIN_INT)) {
+ BLI_assert((int)a1 > 0);
+ }
+ }
+
if (type & UI_BUT_POIN_TYPES) { /* a pointer is required */
if (poin == NULL) {
BLI_assert(0);