[Bf-blender-cvs] [e9c3af3dd76] master: Cleanup: always assign return args for SCULPT_paint_image_canvas_get

Campbell Barton noreply at git.blender.org
Thu May 19 03:18:41 CEST 2022


Commit: e9c3af3dd76641922b1b3e83095d72ce8968fd9b
Author: Campbell Barton
Date:   Thu May 19 10:14:30 2022 +1000
Branches: master
https://developer.blender.org/rBe9c3af3dd76641922b1b3e83095d72ce8968fd9b

Cleanup: always assign return args for SCULPT_paint_image_canvas_get

Asserting the variables weren't NULL raised a warning with GCC 12.1,
instead of suppressing the warning, always assign NULL which is often
expected behavior and makes the function work as documented.

===================================================================

M	source/blender/editors/sculpt_paint/sculpt_paint_image.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
index b0c33a65bc9..975a8f21aaf 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
@@ -460,8 +460,9 @@ bool SCULPT_paint_image_canvas_get(PaintModeSettings *paint_mode_settings,
                                    Image **r_image,
                                    ImageUser **r_image_user)
 {
-  BLI_assert(r_image);
-  BLI_assert(r_image_user);
+  *r_image = nullptr;
+  *r_image_user = nullptr;
+
   ImageData image_data;
   if (!ImageData::init_active_image(ob, &image_data, paint_mode_settings)) {
     return false;



More information about the Bf-blender-cvs mailing list