Skip to content

Commit cc18af7

Browse files
deepin-ci-robot18202781743
authored andcommitted
sync: from linuxdeepin/dtkwidget
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#682
1 parent 81520c5 commit cc18af7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/widgets/dtabbar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ void DTabBarPrivate::layoutTab(int index)
687687
Q_ASSERT(index >= 0);
688688
QTabBarPrivate *d = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d_ptr));
689689
QTabBarPrivate::Tab *tab = d->at(index);
690+
Q_ASSERT(tab);
690691
bool vertical = dtk_verticalTabs(d->shape);
691692

692693
if (!(tab->leftWidget || tab->rightWidget))
@@ -1279,7 +1280,7 @@ void DTabBarPrivate::paintEvent(QPaintEvent *e)
12791280
}
12801281

12811282
// Draw the selected tab last to get it "on top"
1282-
if (selected >= 0) {
1283+
if (selected >= 0 && d->validIndex(selected)) {
12831284
QStyleOptionTab tab;
12841285
initStyleOption(&tab, selected);
12851286
// 强制让文本居中

0 commit comments

Comments
 (0)