Don't crash if the model is badly defined in wxGTK wxDVC

Asserting before dereferencing a null pointer (in BuildBranch(), called
immediately after the asserts in question) is useless, as usual. Use wxCHECK
to complain and avoid crashing instead.

Closes #17776.
This commit is contained in:
Vadim Zeitlin
2017-01-15 17:16:04 +01:00
parent 5ae9694506
commit fad33800dc

View File

@@ -4041,7 +4041,7 @@ gboolean wxDataViewCtrlInternal::iter_children( GtkTreeIter *iter, GtkTreeIter *
return FALSE; return FALSE;
wxGtkTreeModelNode *parent_node = FindNode( parent ); wxGtkTreeModelNode *parent_node = FindNode( parent );
wxASSERT_MSG(parent_node, wxCHECK_MSG(parent_node, FALSE,
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel"); "Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
BuildBranch( parent_node ); BuildBranch( parent_node );
@@ -4081,7 +4081,7 @@ gboolean wxDataViewCtrlInternal::iter_has_child( GtkTreeIter *iter )
return FALSE; return FALSE;
wxGtkTreeModelNode *node = FindNode( iter ); wxGtkTreeModelNode *node = FindNode( iter );
wxASSERT_MSG(node, wxCHECK_MSG(node, FALSE,
"Did you forget a call to ItemAdded()? The iterator is unknown to the wxGtkTreeModel"); "Did you forget a call to ItemAdded()? The iterator is unknown to the wxGtkTreeModel");
BuildBranch( node ); BuildBranch( node );
@@ -4112,7 +4112,7 @@ gint wxDataViewCtrlInternal::iter_n_children( GtkTreeIter *iter )
return 0; return 0;
wxGtkTreeModelNode *parent_node = FindNode( iter ); wxGtkTreeModelNode *parent_node = FindNode( iter );
wxASSERT_MSG(parent_node, wxCHECK_MSG(parent_node, FALSE,
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel"); "Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
BuildBranch( parent_node ); BuildBranch( parent_node );
@@ -4152,7 +4152,7 @@ gboolean wxDataViewCtrlInternal::iter_nth_child( GtkTreeIter *iter, GtkTreeIter
return FALSE; return FALSE;
wxGtkTreeModelNode *parent_node = FindNode( parent ); wxGtkTreeModelNode *parent_node = FindNode( parent );
wxASSERT_MSG(parent_node, wxCHECK_MSG(parent_node, FALSE,
"Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel"); "Did you forget a call to ItemAdded()? The parent node is unknown to the wxGtkTreeModel");
BuildBranch( parent_node ); BuildBranch( parent_node );