Commit 86a0e50a authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

Don't crash on NULL tab text.

parent 7ae86454
...@@ -1145,7 +1145,7 @@ static void TAB_SetItemBounds (HWND hwnd) ...@@ -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 ...@@ -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 */
DrawTextW(hdc, infoPtr->items[iItem].pszText, -1, if (infoPtr->items[iItem].pszText)
&rcText, DT_CALCRECT); {
DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
&rcText, DT_CALCRECT);
}
/* /*
* If not owner draw, then do the drawing ourselves. * If not owner draw, then do the drawing ourselves.
* *
...@@ -1824,14 +1827,17 @@ TAB_DrawItemInterior ...@@ -1824,14 +1827,17 @@ TAB_DrawItemInterior
hFont = CreateFontIndirectA(&logfont); hFont = CreateFontIndirectA(&logfont);
SelectObject(hdc, hFont); SelectObject(hdc, hFont);
ExtTextOutW(hdc, if (infoPtr->items[iItem].pszText)
(lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left, {
(!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top, ExtTextOutW(hdc,
ETO_CLIPPED, (lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
drawRect, (!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
infoPtr->items[iItem].pszText, ETO_CLIPPED,
lstrlenW(infoPtr->items[iItem].pszText), drawRect,
0); infoPtr->items[iItem].pszText,
lstrlenW(infoPtr->items[iItem].pszText),
0);
}
DeleteObject(hFont); DeleteObject(hFont);
} }
...@@ -1841,14 +1847,17 @@ TAB_DrawItemInterior ...@@ -1841,14 +1847,17 @@ 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));
DrawTextW if (infoPtr->items[iItem].pszText)
( {
hdc, DrawTextW
infoPtr->items[iItem].pszText, (
lstrlenW(infoPtr->items[iItem].pszText), hdc,
drawRect, infoPtr->items[iItem].pszText,
DT_LEFT | DT_SINGLELINE lstrlenW(infoPtr->items[iItem].pszText),
drawRect,
DT_LEFT | DT_SINGLELINE
); );
}
} }
*drawRect = rcTemp; /* restore drawRect */ *drawRect = rcTemp; /* restore drawRect */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment