Fix segfault when inserting e.g. fileheader template when the
template file is empty (#3070913, thanks to lphilpot). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5544 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
09b734f921
commit
4998d40f46
@ -1,3 +1,10 @@
|
||||
2011-02-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/templates.c:
|
||||
Fix segfault when inserting e.g. fileheader template when the
|
||||
template file is empty (#3070913, thanks to lphilpot).
|
||||
|
||||
|
||||
2011-02-21 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* plugins/filebrowser.c:
|
||||
|
@ -508,12 +508,15 @@ static void make_comment_block(GString *comment_text, gint filetype_idx, guint i
|
||||
|
||||
/* add line_prefix to every line of comment_text */
|
||||
lines = g_strsplit(comment_text->str, template_eol_char, -1);
|
||||
len = g_strv_length(lines) - 1;
|
||||
for (i = 0; i < len; i++)
|
||||
len = g_strv_length(lines);
|
||||
if (len > 0) /* prevent unsigned wraparound if comment_text is empty */
|
||||
{
|
||||
tmp = lines[i];
|
||||
lines[i] = g_strconcat(prefix, tmp, NULL);
|
||||
g_free(tmp);
|
||||
for (i = 0; i < len - 1; i++)
|
||||
{
|
||||
tmp = lines[i];
|
||||
lines[i] = g_strconcat(prefix, tmp, NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
}
|
||||
tmp = g_strjoinv(template_eol_char, lines);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user