No longer tries to create a "" label. An empty label is now NULL.

Probably among other, this fixes the BSlider appearance without a label.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-02-02 18:15:52 +00:00
parent f2c54a03a6
commit 7d34abc3e8

View File

@ -270,13 +270,18 @@ BControl::DetachedFromWindow()
void
BControl::SetLabel(const char *string)
BControl::SetLabel(const char *label)
{
if (fLabel && string && strcmp(fLabel, string) == 0)
if (label != NULL && !label[0])
label = NULL;
// Has the label been changed?
if ((fLabel && label && !strcmp(fLabel, label))
|| ((fLabel == NULL || !fLabel[0]) && label == NULL))
return;
free(fLabel);
fLabel = strdup(string ? string : B_EMPTY_STRING);
fLabel = label ? strdup(label) : NULL;
Invalidate();
}