DRW: Fix texture paint crashing if object has no material slot
authorClément Foucault <foucault.clem@gmail.com>
Sat, 22 Dec 2018 19:17:42 +0000 (20:17 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Fri, 11 Jan 2019 15:00:23 +0000 (16:00 +0100)
source/blender/draw/modes/paint_texture_mode.c

index a89616c..200daf6 100644 (file)
@@ -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 {