This is a fix for coverity issue CID: 517
authorKent Mein <mein@cs.umn.edu>
Wed, 29 Oct 2008 17:45:02 +0000 (17:45 +0000)
committerKent Mein <mein@cs.umn.edu>
Wed, 29 Oct 2008 17:45:02 +0000 (17:45 +0000)
Basically the code was referencing var[-1] it wasn't using it
but also did not need to be set in those cases.  So I moved
the assignments so it skips the -1 case.

Kent

source/blender/src/buttons_editing.c

index 45267f506226acf58e2c61923b3acccd4bdb59f2..f362fa815ce58a7c85fc46cb2481dcc63288cfd6 100644 (file)
@@ -5833,11 +5833,11 @@ void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsig
        for(i=-1; i<8; i++) {
                char str[64];
                int loos;
        for(i=-1; i<8; i++) {
                char str[64];
                int loos;
-               mtex= sd->mtex[i];
 
                if(i==-1)
                        strcpy(str, "Default");
                else {
 
                if(i==-1)
                        strcpy(str, "Default");
                else {
+                       mtex= sd->mtex[i];
                        if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
                        else strcpy(str, "");
                }
                        if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
                        else strcpy(str, "");
                }
@@ -5848,12 +5848,12 @@ void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsig
 
        cy= orig_y-20;
        cx+= 85;
 
        cy= orig_y-20;
        cx+= 85;
-       mtex= sd->mtex[sd->texact];
 
        if(sd->texact == -1) {
                uiBlockBeginAlign(block);
                uiDefBut(block,LABEL,B_NOP,"",cx,cy,115,20,0,0,0,0,0,""); /* Padding */
        } else {
 
        if(sd->texact == -1) {
                uiBlockBeginAlign(block);
                uiDefBut(block,LABEL,B_NOP,"",cx,cy,115,20,0,0,0,0,0,""); /* Padding */
        } else {
+               mtex= sd->mtex[sd->texact];
                ID *id= NULL;
                uiBlockBeginAlign(block);
                
                ID *id= NULL;
                uiBlockBeginAlign(block);