From e9bd3058660a6881efdfcd0524cc07e55771d818 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann?= Date: Sat, 26 Mar 2005 02:28:32 +0000 Subject: [PATCH] Return NULL if nothing is selected. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fri Mar 25 21:25:31 2005 Søren Sandmann * sysprof.c (get_current_object): Return NULL if nothing is selected. --- ChangeLog | 5 +++++ TODO | 6 +++--- sysprof.c | 18 +++++++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9a2cf6..724b67f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Mar 25 21:25:31 2005 Søren Sandmann + + * sysprof.c (get_current_object): Return NULL if nothing is + selected. + Fri Mar 25 20:54:08 2005 Søren Sandmann * TODO: More updates diff --git a/TODO b/TODO index feb4940..331304c 100644 --- a/TODO +++ b/TODO @@ -35,9 +35,6 @@ - hook up menu items view/start etc (or possibly get rid of them or move them) -- crashes when you ctrl-click the selected item in the top left pane - ssp: looks like it doesn't handle the none-selected case - - Move "samples" label to the toolbar, then get rid of statusbar. - consider caching [filename => bin_file] @@ -73,6 +70,9 @@ DONE: +- crashes when you ctrl-click the selected item in the top left pane + ssp: looks like it doesn't handle the none-selected case + - loading and saving - consider making ProfileObject more of an object. diff --git a/sysprof.c b/sysprof.c index 4447f66..bdbd583 100644 --- a/sysprof.c +++ b/sysprof.c @@ -675,13 +675,17 @@ get_current_object (Application *app) selection = gtk_tree_view_get_selection (app->object_view); - gtk_tree_selection_get_selected (selection, &model, &selected); - - gtk_tree_model_get (model, &selected, - OBJECT_OBJECT, &object, - -1); - - return object; + if (gtk_tree_selection_get_selected (selection, &model, &selected)) + { + gtk_tree_model_get (model, &selected, + OBJECT_OBJECT, &object, + -1); + return object; + } + else + { + return NULL; + } } static void -- 2.7.4