Fixed segfault when inserting comments and no filetype is set

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@419 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2006-06-07 16:50:41 +00:00
parent 4a8003f848
commit 01ef13c18c
2 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2006-06-07 Nick Treleaven <nick.treleaven@btinternet.com>
* src/callbacks.c: Fixed segfault when inserting comments and no
filetype is set.
2006-06-06 Enrico Troeger <enrico.troeger@uvena.de> 2006-06-06 Enrico Troeger <enrico.troeger@uvena.de>
* src/highlighting.c: enabled folding for markup filetypes * src/highlighting.c: enabled folding for markup filetypes
@ -9,7 +15,7 @@
* doc/geany.docbook: Added save current file behaviour when building. * doc/geany.docbook: Added save current file behaviour when building.
* src/sci_cb.c: Fix empty white box glitch with tag autocompletion, * 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 <enrico.troeger@uvena.de> 2006-06-05 Enrico Troeger <enrico.troeger@uvena.de>

View File

@ -2020,6 +2020,12 @@ on_comments_function_activate (GtkMenuItem *menuitem,
gchar *cur_tag = NULL; gchar *cur_tag = NULL;
gint line = -1, pos = 0; 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 && if (doc_list[idx].file_type->id != GEANY_FILETYPES_JAVA &&
doc_list[idx].file_type->id != GEANY_FILETYPES_ALL) 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(); gint idx = document_get_cur_idx();
gchar *text; 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) switch (doc_list[idx].file_type->id)
{ {
case GEANY_FILETYPES_PASCAL: case GEANY_FILETYPES_PASCAL:
@ -2098,6 +2110,12 @@ on_comments_gpl_activate (GtkMenuItem *menuitem,
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
gchar *text; 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) switch (doc_list[idx].file_type->id)
{ {
case GEANY_FILETYPES_PASCAL: case GEANY_FILETYPES_PASCAL:
@ -2152,6 +2170,12 @@ on_comments_fileheader_activate (GtkMenuItem *menuitem,
gchar *text; gchar *text;
gchar *ext = NULL; 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) if (doc_list[idx].file_name == NULL)
ext = doc_list[idx].file_type->extension; ext = doc_list[idx].file_type->extension;