Fix crash in wxTreeListCtrl::GetItemText() if text was never set.
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
This commit is contained in:
parent
0f31a78f36
commit
35ee173d0f
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user