Asking for the text of an item is not an error even if it was never set for
any column but the first one so just return an empty string in this case
instead of crashing.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69805
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// 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)