Commit 9f83313c authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

Fixes bug #166350 (Gedit crashed when insert date and time)

2005-07-29  Paolo Maggi  <paolo@gnome.org>

	Fixes bug #166350 (Gedit crashed when insert date and time)

	* time/time.c (get_format_from_list): return 0 if no format
	is selected (should never happen).
parent de2c749d
2005-07-29 Paolo Maggi <paolo@gnome.org>
Fixes bug #166350 (Gedit crashed when insert date and time)
* time/time.c (get_format_from_list): return 0 if no format
is selected (should never happen).
2005-07-24 Paolo Borelli <pborelli@katamail.com>
* sample/sample.c: check the right pointer. Patch from Ike Gingerich.
......
......@@ -399,7 +399,9 @@ create_model (GtkWidget *listview, const gchar *sel_format)
++i;
}
/* fall back to selecting the first iter */
/* Fall back to selecting the first iter. This covers the case when sf is not a format in
* formats[] since the /apps/gedit-2/plugins/time/selected_format is broken or contains an
* unknown format. */
if (!gtk_tree_selection_get_selected (selection, NULL, NULL))
{
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
......@@ -910,24 +912,23 @@ time_world_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname
static gint
get_format_from_list (GtkWidget *listview)
{
GtkTreeModel *model;
GtkTreeModel *model = NULL;
GtkTreeSelection *selection;
GtkTreeIter iter;
gint selected_value;
gint selected_value = 0;
gedit_debug (DEBUG_PLUGINS, "");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (listview));
g_return_val_if_fail (model != NULL, 0);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (listview));
g_return_val_if_fail (selection != NULL, 0);
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
g_return_val_if_fail (model != NULL, 0);
gtk_tree_model_get (model, &iter, COLUMN_INDEX, &selected_value, -1);
}
gedit_debug (DEBUG_PLUGINS, "");
else
g_return_val_if_reached (0);
return selected_value;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment