summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/bookmark_editor_gtk.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 00:36:35 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 00:36:35 +0000
commitc4cad374ad045af4593dff176039299b40e88056 (patch)
tree34e7af7cb8fd9093db96781f59514e635fdf3c06 /chrome/browser/gtk/bookmark_editor_gtk.cc
parent8624ef98b5564b398429b90fcc34cafe232c7e90 (diff)
downloadchromium_src-c4cad374ad045af4593dff176039299b40e88056.zip
chromium_src-c4cad374ad045af4593dff176039299b40e88056.tar.gz
chromium_src-c4cad374ad045af4593dff176039299b40e88056.tar.bz2
Fix crash in bookmark editor. We crash when we don't have a selected folder, but we don't select
a folder by default when we're adding a new bookmark. Review URL: http://codereview.chromium.org/115598 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_editor_gtk.cc')
-rw-r--r--chrome/browser/gtk/bookmark_editor_gtk.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/gtk/bookmark_editor_gtk.cc b/chrome/browser/gtk/bookmark_editor_gtk.cc
index f4da66e..7f5ed6f 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk.cc
+++ b/chrome/browser/gtk/bookmark_editor_gtk.cc
@@ -183,14 +183,20 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) {
tree_selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view_));
+ GtkTreePath* path = NULL;
if (selected_id) {
- GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store_),
- &selected_iter);
- gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path);
- gtk_tree_selection_select_path(tree_selection_, path);
- gtk_tree_path_free(path);
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store_),
+ &selected_iter);
+ } else {
+ // We don't have a selected parent (Probably because we're making a new
+ // bookmark). Select the first item in the list.
+ path = gtk_tree_path_new_from_string("0");
}
+ gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path);
+ gtk_tree_selection_select_path(tree_selection_, path);
+ gtk_tree_path_free(path);
+
GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window),
GTK_POLICY_NEVER,