diff --git a/src/bin/main.c b/src/bin/main.c
index fb1fb97..9b388de 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1131,17 +1131,18 @@ ewl_test_cb_test_selected(Ewl_Widget *w, void *ev __UNUS
tree_data = ewl_mvc_data_get(EWL_MVC(w));
sel = ewl_mvc_selected_get(EWL_MVC(w));
+ if (!sel)
+ goto exit_callback;
/* don't care about the top level rows */
if (tree_data == sel->sel.data)
- {
- free(sel);
- return;
- }
+ goto clear_selection;
/* get the test */
ecore_list_index_goto(sel->sel.data, sel->row);
test = ecore_list_current(sel->sel.data);
+ if (!test)
+ goto free_selection;
/* we need to determine if this is the unit test case. if it is we
* need to treat it specially */
@@ -1152,7 +1153,12 @@ ewl_test_cb_test_selected(Ewl_Widget *w, void *ev __UNUSE
else
run_test_boxed(test);
+clear_selection:
+ ewl_mvc_selected_clear(EWL_MVC(w));
+free_selection:
free(sel);
+exit_callback:
+ return;
}
static void *