X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f81ccc1148c5a1f4ca14e2ad25280f7a6731593c..a9ed8caa09bc542a2ad9f752c0a6ca63c7119747:/src/generic/treelist.cpp diff --git a/src/generic/treelist.cpp b/src/generic/treelist.cpp index f7aca4aabb..18cb193d18 100644 --- a/src/generic/treelist.cpp +++ b/src/generic/treelist.cpp @@ -758,7 +758,12 @@ const wxString& wxTreeListModel::GetItemText(Node* item, unsigned col) const // empty string we can return reference to. wxCHECK_MSG( item, m_root->m_text, "Invalid item" ); - return col == 0 ? item->m_text : item->GetColumnText(col); + // Notice that asking for the text of a column of an item that doesn't have + // any column texts is not an error so we simply return an empty string in + // this case. + return col == 0 ? item->m_text + : item->HasColumnsTexts() ? item->GetColumnText(col) + : m_root->m_text; } void wxTreeListModel::SetItemText(Node* item, unsigned col, const wxString& text)