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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-04-30 13:44:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-30 13:48:41 +0300
commitf4d5a69cf8512aafcc697d1b09f65489015b6af4 (patch)
treec3bd385704d734cd1e1ea7a7013ab64087117857 /source
parentd6b26b3fa0c46c6a9d9c9e5d3816a713dfa261a7 (diff)
Fix crash running constraint, modifier, fx from missing NULL check
None of these generic poll functions had NULL pointer checks, since all operators that use these functions expect a valid constraint, modifier .. etc. Add the NULL check to the poll function. Ref D11126 Reviewed By: mont29, Severin
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_constraint.c5
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c4
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_shader_fx.c6
4 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 244124a6e0a..8ed1b862521 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -706,6 +706,11 @@ static bool edit_constraint_poll_generic(bContext *C,
return false;
}
+ if (!con) {
+ CTX_wm_operator_poll_msg_set(C, "Context missing active constraint");
+ return false;
+ }
+
if (!is_liboverride_allowed && BKE_constraint_is_nonlocal_in_liboverride(ob, con)) {
CTX_wm_operator_poll_msg_set(
C, "Cannot edit constraints coming from linked data in a library override");
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 3995728c428..6d1c4481883 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -443,6 +443,10 @@ static bool gpencil_edit_modifier_poll_generic(bContext *C,
return false;
}
+ if (!mod) {
+ return false;
+ }
+
if (!is_liboverride_allowed && BKE_gpencil_modifier_is_nonlocal_in_liboverride(ob, mod)) {
CTX_wm_operator_poll_msg_set(
C, "Cannot edit modifiers coming from linked data in a library override");
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 49c07b28f07..02b0d71c90e 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1051,6 +1051,10 @@ bool edit_modifier_poll_generic(bContext *C,
return false;
}
+ if (!mod) {
+ return false;
+ }
+
if (!is_liboverride_allowed && BKE_modifier_is_nonlocal_in_liboverride(ob, mod)) {
CTX_wm_operator_poll_msg_set(
C, "Cannot edit modifiers coming from linked data in a library override");
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index 585a1e22a84..7634c14ee0f 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -368,8 +368,12 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt
return false;
}
+ if (!fx) {
+ return false;
+ }
+
if (ID_IS_OVERRIDE_LIBRARY(ob)) {
- if ((fx == NULL) || (fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) {
+ if ((fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) {
CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override");
return false;
}