Skip to content

Commit d22d8f1

Browse files
author
Romain Mardulyn
committed
WT-14065: Fix segfault on WTableView::itemWidget()
Fixes segfault on WTableView::itemWidget() when ajax was not active. This was due the use of headerColumnsTable_, which does not exist if ajax is not available.
1 parent de98b49 commit d22d8f1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Wt/WTableView.C

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,16 +1975,19 @@ int WTableView::renderedColumnsCount() const
19751975

19761976
WWidget *WTableView::itemWidget(const WModelIndex& index) const
19771977
{
1978-
if ((index.column() < headerColumnsTable_->count() || isColumnRendered(index.column())) &&
1978+
const int columnCount = ajaxMode() ? headerColumnsTable_->count() : plainTable_->columnCount();
1979+
1980+
if ((index.column() < columnCount || isColumnRendered(index.column())) &&
19791981
isRowRendered(index.row()))
19801982
{
19811983
int renderedRow = index.row() - firstRow();
19821984
int renderedCol;
19831985

1984-
if (index.column() < headerColumnsTable_->count())
1986+
if (index.column() < columnCount) {
19851987
renderedCol = index.column();
1986-
else
1987-
renderedCol = headerColumnsTable_->count() + index.column() - firstColumn();
1988+
} else {
1989+
renderedCol = columnCount + index.column() - firstColumn();
1990+
}
19881991

19891992
if (ajaxMode()) {
19901993
ColumnWidget *column = columnContainer(renderedCol);

0 commit comments

Comments
 (0)