Fix various potential bugs from coverity reports (NULL dereference, negative number assigned to uint...).

Note: the wm_jobs needs proper fix, we cannot have that kind of inconsistencies in some 'public' API!
This commit is contained in:
2016-01-25 16:55:08 +01:00
parent 9e56d75470
commit 60663c8ec4
4 changed files with 7 additions and 6 deletions

View File

@@ -604,7 +604,8 @@ void BKE_object_defgroup_mirror_selection(
bool *dg_flags_sel, int *r_dg_flags_sel_tot)
{
bDeformGroup *defgroup;
unsigned int i, i_mirr;
unsigned int i;
int i_mirr;
for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
if (dg_selection[i]) {

View File

@@ -168,7 +168,7 @@ static void load_tex_task_cb_ex(void *userdata, void *UNUSED(userdata_chunck), c
bool convert_to_linear = false;
struct ColorSpace *colorspace = NULL;
if (mtex->tex->type == TEX_IMAGE && mtex->tex->ima) {
if (mtex->tex && mtex->tex->type == TEX_IMAGE && mtex->tex->ima) {
ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool);
/* For consistency, sampling always returns color in linear space */
if (tex_ibuf && tex_ibuf->rect_float == NULL) {

View File

@@ -2081,9 +2081,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
bool use_face_sel;
bool use_depth;
float (*blur_weight_func)(MDeformVert *, WeightPaintInfo *) =
wpd->do_multipaint ? wpaint_blur_weight_multi : wpaint_blur_weight_single;
const float pressure = RNA_float_get(itemptr, "pressure");
const float brush_size_pressure =
BKE_brush_size_get(scene, brush) * (BKE_brush_use_size_pressure(scene, brush) ? pressure : 1.0f);
@@ -2102,6 +2099,9 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
return;
}
float (*blur_weight_func)(MDeformVert *, WeightPaintInfo *) =
wpd->do_multipaint ? wpaint_blur_weight_multi : wpaint_blur_weight_single;
vc = &wpd->vc;
ob = vc->obact;
me = ob->data;

View File

@@ -294,7 +294,7 @@ bool WM_jobs_is_running(wmJob *wm_job)
bool WM_jobs_is_stopped(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
return wm_job->stop;
return wm_job ? wm_job->stop : true; /* XXX to be redesigned properly. */
}
void *WM_jobs_customdata_get(wmJob *wm_job)