]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treelist.cpp
Update the text part of combobox when changing text of selected item in wxGTK.
[wxWidgets.git] / src / generic / treelist.cpp
index f7aca4aabb5a314336ac6de389c24c514f56cc77..18cb193d18a78b6786c7fff6c8f7babe04407f41 100644 (file)
@@ -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)