diff --git a/ChangeLog b/ChangeLog index b99212e6..6ef1f79f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-06-07 Nick Treleaven + + * src/callbacks.c: Fixed segfault when inserting comments and no + filetype is set. + + 2006-06-06 Enrico Troeger * src/highlighting.c: enabled folding for markup filetypes @@ -9,7 +15,7 @@ * doc/geany.docbook: Added save current file behaviour when building. * src/sci_cb.c: Fix empty white box glitch with tag autocompletion, - also improves typing response efficiency. + also improves typing response efficiency. 2006-06-05 Enrico Troeger diff --git a/src/callbacks.c b/src/callbacks.c index c40afcf0..fe212f38 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -2020,6 +2020,12 @@ on_comments_function_activate (GtkMenuItem *menuitem, gchar *cur_tag = NULL; gint line = -1, pos = 0; + if (doc_list[idx].file_type == NULL) + { + msgwin_status_add(_("Please set the filetype for the current file before using this function.")); + return; + } + if (doc_list[idx].file_type->id != GEANY_FILETYPES_JAVA && doc_list[idx].file_type->id != GEANY_FILETYPES_ALL) { @@ -2064,6 +2070,12 @@ on_comments_multiline_activate (GtkMenuItem *menuitem, gint idx = document_get_cur_idx(); gchar *text; + if (doc_list[idx].file_type == NULL) + { + msgwin_status_add(_("Please set the filetype for the current file before using this function.")); + return; + } + switch (doc_list[idx].file_type->id) { case GEANY_FILETYPES_PASCAL: @@ -2098,6 +2110,12 @@ on_comments_gpl_activate (GtkMenuItem *menuitem, gint idx = document_get_cur_idx(); gchar *text; + if (doc_list[idx].file_type == NULL) + { + msgwin_status_add(_("Please set the filetype for the current file before using this function.")); + return; + } + switch (doc_list[idx].file_type->id) { case GEANY_FILETYPES_PASCAL: @@ -2152,6 +2170,12 @@ on_comments_fileheader_activate (GtkMenuItem *menuitem, gchar *text; gchar *ext = NULL; + if (doc_list[idx].file_type == NULL) + { + msgwin_status_add(_("Please set the filetype for the current file before using this function.")); + return; + } + if (doc_list[idx].file_name == NULL) ext = doc_list[idx].file_type->extension;