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>2020-03-26 04:49:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-26 07:32:40 +0300
commit33da997193b570f12db57fabcbe02e7283b7bbfc (patch)
tree092bc162d034f17c6c72fde5c0a490b5d3f13f85 /source/blender/editors/sculpt_paint/paint_image_proj.c
parent52cff88f72674ff77638a5e60d8837e6c715b34e (diff)
Fix crashes from various missing checks in operator poll functions
Issues exposed by 'bl_run_operators.py' utility.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 8362a4a576a..c56ce8fd183 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -64,6 +64,7 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_lib_id.h"
@@ -6201,11 +6202,12 @@ void PAINT_OT_project_image(wmOperatorType *ot)
static bool texture_paint_image_from_view_poll(bContext *C)
{
- if (BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0) == NULL) {
+ bScreen *screen = CTX_wm_screen(C);
+ if (!(screen && BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0))) {
CTX_wm_operator_poll_msg_set(C, "No 3D viewport found to create image from");
return false;
}
- if (!GPU_is_initialized()) {
+ if (G.background || !GPU_is_initialized()) {
return false;
}
return true;
@@ -6754,7 +6756,7 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
/* api callbacks */
ot->invoke = texture_paint_add_texture_paint_slot_invoke;
ot->exec = texture_paint_add_texture_paint_slot_exec;
- ot->poll = ED_operator_object_active;
+ ot->poll = ED_operator_object_active_editable_mesh;
/* flags */
ot->flag = OPTYPE_UNDO;