[Bf-blender-cvs] [bda2cd8ba5d] master: DRW: Fix texture paint crashing if object has no material slot

Clément Foucault noreply at git.blender.org
Fri Jan 11 16:00:26 CET 2019


Commit: bda2cd8ba5d14a39aef1927d168f2817d20bbaa8
Author: Clément Foucault
Date:   Sat Dec 22 20:17:42 2018 +0100
Branches: master
https://developer.blender.org/rBbda2cd8ba5d14a39aef1927d168f2817d20bbaa8

DRW: Fix texture paint crashing if object has no material slot

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

M	source/blender/draw/modes/paint_texture_mode.c

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

diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index a89616c2cae..200daf66c83 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -282,7 +282,7 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
 
 					for (int i = 0; i < mat_nr; i++) {
 						const int index = use_material_slots ? i : 0;
-						if (stl->g_data->shgroup_image_array[index]) {
+						if ((i < me->totcol) && stl->g_data->shgroup_image_array[index]) {
 							DRW_shgroup_call_add(stl->g_data->shgroup_image_array[index], geom_array[i], ob->obmat);
 						}
 						else {



More information about the Bf-blender-cvs mailing list