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:
authorCampbell Barton <ideasman42@gmail.com>2012-09-14 10:17:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-14 10:17:14 +0400
commit7a71f58af3b5f70e8982d827d1fef7e8bc4e4ec8 (patch)
treeae5ee3e8c3a1d029e54531bbfd5ac8db42d9f7d9 /source/blender/editors
parent3957efdd38d0d5136f8d106de3a79e07b7b0b15f (diff)
fixes for NULL checks, remove some redundant checks and add some in that have been removed by accident as code has been updated.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/keyframes_draw.c2
-rw-r--r--source/blender/editors/armature/poseobject.c20
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/mesh/meshtools.c18
-rw-r--r--source/blender/editors/physics/particle_object.c6
-rw-r--r--source/blender/editors/screen/screen_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c2
-rw-r--r--source/blender/editors/space_node/node_group.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/util/ed_util.c4
12 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 46537674e59..6c9105dde69 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -412,7 +412,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
* -> firstly, handles must have same central value as each other
* -> secondly, handles which control that section of the curve must be constant
*/
- if ((!prev) || (!beztn)) return;
+ if (prev == NULL) return;
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1]) == 0) return;
if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) == 0) return;
if (IS_EQF(prev->vec[1][1], prev->vec[2][1]) == 0) return;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index e4f1e6d3e8b..e9424a08b0c 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -2350,20 +2350,18 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op)
for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
pose_bone_do_paste(ob, pchan, only_select, 0);
}
-
+
/* free temp data - free manually as was copied without constraints */
- if (dummyPose) {
- for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
- if (pchan->prop) {
- IDP_FreeProperty(pchan->prop);
- MEM_freeN(pchan->prop);
- }
+ for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
+ if (pchan->prop) {
+ IDP_FreeProperty(pchan->prop);
+ MEM_freeN(pchan->prop);
}
-
- /* was copied without constraints */
- BLI_freelistN(&dummyPose->chanbase);
- MEM_freeN(dummyPose);
}
+
+ /* was copied without constraints */
+ BLI_freelistN(&dummyPose->chanbase);
+ MEM_freeN(dummyPose);
}
else {
/* no animation, so just reset whole pose to rest pose
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index e825ff7880d..f6f12f98181 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -835,7 +835,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
if (G.debug & G_DEBUG)
printf("%s, error: requested preview image does not exist", __func__);
}
- if (!prv_img->rect[size]) {
+ else if (!prv_img->rect[size]) {
prv_img->w[size] = render_size;
prv_img->h[size] = render_size;
prv_img->changed[size] = 1;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index ed6b2e00119..b379a2e7b4c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -944,7 +944,7 @@ void UI_SetTheme(int spacetype, int regionid)
}
}
-bTheme *UI_GetTheme()
+bTheme *UI_GetTheme(void)
{
return U.themes.first;
}
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 06dcac0505a..a7467ee4c79 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -442,18 +442,20 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
if (me->totpoly) {
- /* make mapping for materials */
- for (a = 1; a <= base->object->totcol; a++) {
- ma = give_current_material(base->object, a);
+ if (totmat) {
+ /* make mapping for materials */
+ for (a = 1; a <= base->object->totcol; a++) {
+ ma = give_current_material(base->object, a);
- for (b = 0; b < totcol; b++) {
- if (ma == matar[b]) {
- matmap[a - 1] = b;
- break;
+ for (b = 0; b < totcol; b++) {
+ if (ma == matar[b]) {
+ matmap[a - 1] = b;
+ break;
+ }
}
}
}
-
+
CustomData_merge(&me->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
CustomData_copy_data(&me->pdata, &pdata, 0, polyofs, me->totpoly);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index b57500df719..a17d84af128 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -98,12 +98,14 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
- int mode_orig = ob->mode;
+ int mode_orig;
+
if (!scene || !ob)
return OPERATOR_CANCELLED;
+ mode_orig = ob->mode;
object_remove_particle_system(scene, ob);
/* possible this isn't the active object
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 9f9d0bab15c..50a210e5d7c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1370,12 +1370,12 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == EVT_ACTIONZONE_AREA) {
sActionzoneData *sad = event->customdata;
- if (sad->modifier > 0) {
+ if (sad == NULL || sad->modifier > 0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if (sad == NULL || sad->sa1 == NULL || sad->az == NULL)
+ if (sad->sa1 == NULL || sad->az == NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas not equal it should be passed on */
@@ -2284,12 +2284,12 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == EVT_ACTIONZONE_AREA) {
sActionzoneData *sad = event->customdata;
- if (sad->modifier > 0) {
+ if (sad == NULL || sad->modifier > 0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if (sad == NULL || sad->sa1 == NULL || sad->sa2 == NULL)
+ if (sad->sa1 == NULL || sad->sa2 == NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas equal it should be passed on */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index e1f0a06d556..7c3f376df91 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5372,8 +5372,8 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
if (!imapaint->paintcursor) {
imapaint->paintcursor =
- WM_paint_cursor_activate(wm, image_paint_poll,
- brush_drawcursor, NULL);
+ WM_paint_cursor_activate(wm, image_paint_poll,
+ brush_drawcursor, NULL);
}
}
}
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index cdecda63432..0e82d8651f3 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -341,7 +341,7 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
{
/* callback when opening texture user selection menu, to create buttons. */
SpaceButs *sbuts = CTX_wm_space_buts(C);
- ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
+ ButsContextTexture *ct = sbuts->texuser;
ButsTextureUser *user;
uiBlock *block = uiLayoutGetBlock(layout);
const char *last_category = NULL;
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 77583ae1325..b76cc05af5c 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -950,7 +950,7 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
int toselect = (link->tonode && (link->tonode->flag & NODE_SELECT) && link->tonode != gnode);
linkn = link->next;
- if (gnode && ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode))) {
+ if ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode)) {
/* remove all links to/from the gnode.
* this can remove link information, but there's no general way to preserve it.
*/
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 90da3824870..d1f0d8fa25e 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7232,7 +7232,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
setlinestyle(0);
}
}
- else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti) && (cti->get_constraint_targets)) {
+ else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti->get_constraint_targets)) {
cti->get_constraint_targets(curcon, &targets);
for (ct = targets.first; ct; ct = ct->next) {
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index b0a2a24f25b..23d6b0a075e 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -89,7 +89,9 @@ void ED_editors_init(bContext *C)
}
/* image editor paint mode */
- ED_space_image_paint_update(wm, sce->toolsettings);
+ if (sce) {
+ ED_space_image_paint_update(wm, sce->toolsettings);
+ }
}
/* frees all editmode stuff */