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:
authorPhilipp Oeser <info@graphics-engineer.com>2022-02-15 17:42:17 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-02-22 13:55:57 +0300
commit574f685855e32d639f1ad7b2e8dd788ff291568d (patch)
tree3fe4b3d12132a0d77f7617c1b394d2c21a8bd48c
parentff059210992621ca5e3c8e59152b67d711888ed2 (diff)
Fix T95787: Texture paint: Apply Camera Image crash for certain images
This does not happen with **any** image, but with images that have ID properties. ID properties are used to store view projection matrices (e.g. for reprojection with `Image from View` or `Quick Edit` -- these are the ones we are interested in), but of course they can be used for anything else, too. The images in the file from the report have ID properties from an Addon for example. So the crash can reliably be reproduced with **any** image doing the following: ``` bpy.data.images['myImage']['myIDprop'] = "foo" ``` This would lead code in `texture_paint_camera_project_exec` to think the needed `view_data` is on the image (but in reality it was just some other IDprop). Solution is simple: just check `view_data` is really valid after getting it from the IDprops. Maniphest Tasks: T95787 Differential Revision: https://developer.blender.org/D14116
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 558a5db673c..16de5fb537f 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -6111,7 +6111,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
view_data = IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
/* type check to make sure its ok */
- if (view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
+ if (view_data != NULL &&
+ (view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT)) {
BKE_report(op->reports, RPT_ERROR, "Image project data invalid");
return OPERATOR_CANCELLED;
}