Don't crash on NULL tab text.
This commit is contained in:
parent
7ae8645467
commit
86a0e50a1d
|
@ -1145,7 +1145,7 @@ static void TAB_SetItemBounds (HWND hwnd)
|
||||||
/* Set the leftmost position of the tab. */
|
/* Set the leftmost position of the tab. */
|
||||||
infoPtr->items[curItem].rect.left = curItemLeftPos;
|
infoPtr->items[curItem].rect.left = curItemLeftPos;
|
||||||
|
|
||||||
if (lStyle & TCS_FIXEDWIDTH)
|
if ((lStyle & TCS_FIXEDWIDTH) || !infoPtr->items[curItem].pszText)
|
||||||
{
|
{
|
||||||
infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
|
infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left +
|
||||||
max(infoPtr->tabWidth, icon_width);
|
max(infoPtr->tabWidth, icon_width);
|
||||||
|
@ -1682,8 +1682,11 @@ TAB_DrawItemInterior
|
||||||
rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
|
rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
|
||||||
|
|
||||||
/* get the rectangle that the text fits in */
|
/* get the rectangle that the text fits in */
|
||||||
|
if (infoPtr->items[iItem].pszText)
|
||||||
|
{
|
||||||
DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
|
DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
|
||||||
&rcText, DT_CALCRECT);
|
&rcText, DT_CALCRECT);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* If not owner draw, then do the drawing ourselves.
|
* If not owner draw, then do the drawing ourselves.
|
||||||
*
|
*
|
||||||
|
@ -1824,6 +1827,8 @@ TAB_DrawItemInterior
|
||||||
hFont = CreateFontIndirectA(&logfont);
|
hFont = CreateFontIndirectA(&logfont);
|
||||||
SelectObject(hdc, hFont);
|
SelectObject(hdc, hFont);
|
||||||
|
|
||||||
|
if (infoPtr->items[iItem].pszText)
|
||||||
|
{
|
||||||
ExtTextOutW(hdc,
|
ExtTextOutW(hdc,
|
||||||
(lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
|
(lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
|
||||||
(!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
|
(!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
|
||||||
|
@ -1832,6 +1837,7 @@ TAB_DrawItemInterior
|
||||||
infoPtr->items[iItem].pszText,
|
infoPtr->items[iItem].pszText,
|
||||||
lstrlenW(infoPtr->items[iItem].pszText),
|
lstrlenW(infoPtr->items[iItem].pszText),
|
||||||
0);
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
DeleteObject(hFont);
|
DeleteObject(hFont);
|
||||||
}
|
}
|
||||||
|
@ -1841,6 +1847,8 @@ TAB_DrawItemInterior
|
||||||
debugstr_w(infoPtr->items[iItem].pszText), center_offset_h, center_offset_v,
|
debugstr_w(infoPtr->items[iItem].pszText), center_offset_h, center_offset_v,
|
||||||
drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
|
drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
|
||||||
(rcText.right-rcText.left));
|
(rcText.right-rcText.left));
|
||||||
|
if (infoPtr->items[iItem].pszText)
|
||||||
|
{
|
||||||
DrawTextW
|
DrawTextW
|
||||||
(
|
(
|
||||||
hdc,
|
hdc,
|
||||||
|
@ -1850,6 +1858,7 @@ TAB_DrawItemInterior
|
||||||
DT_LEFT | DT_SINGLELINE
|
DT_LEFT | DT_SINGLELINE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*drawRect = rcTemp; /* restore drawRect */
|
*drawRect = rcTemp; /* restore drawRect */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue