[#20987] A small bug in logic editor
authorCampbell Barton <ideasman42@gmail.com>
Mon, 8 Feb 2010 19:24:13 +0000 (19:24 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 8 Feb 2010 19:24:13 +0000 (19:24 +0000)
string was used, uninitialized.

source/blender/editors/interface/interface.c

index cd9ebe6996f9463b17527688567f041c1202a1db..c54b062c8153959045174cdeea12e7fce4f49923 100644 (file)
@@ -1499,7 +1499,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
                }
 
                if(!buf) {
-                       BLI_strncpy(str, "", maxlen);
+                       str[0] = '\0';
                }
                else if(buf && buf != str) {
                        /* string was too long, we have to truncate */
@@ -1511,12 +1511,12 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
                /* ID pointer */
                if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
                        ID *id= *(but->idpoin_idpp);
-                       if(id)
+                       if(id) {
                                BLI_strncpy(str, id->name+2, maxlen);
+                               return;
+                       }
                }
-               else {
-                       str[0] = '\0';
-               }
+               str[0] = '\0';
                return;
        }
        else if(but->type == TEX) {
@@ -2067,7 +2067,7 @@ void ui_check_but(uiBut *but)
                
        case HOTKEYEVT:
                if (but->flag & UI_SELECT) {
-                       strncpy(but->drawstr, "", UI_MAX_DRAW_STR);
+                       but->drawstr[0]= '\0';
                        
                        if(but->modifier_key) {
                                char *str= but->drawstr;