1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

strip_real_length(): initialize last_color_pos and last_color_len to

-1. Word hilighting crashed if there was no colors set in the line..


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1282 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-22 08:35:53 +00:00 committed by cras
parent fc17069cec
commit 62a7faf5b2
2 changed files with 11 additions and 4 deletions

View File

@ -630,6 +630,11 @@ int strip_real_length(const char *str, int len,
{
const char *start = str;
if (last_color_pos != NULL)
*last_color_pos = -1;
if (last_color_len != NULL)
*last_color_len = -1;
while (*str != '\0') {
if (*str == 3) {
const char *mircstart = str;

View File

@ -447,10 +447,12 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
/* end of the line */
pos = strip_real_length(str, next_hilight_end,
&color_pos, &color_len);
lastcolor = g_strndup(str+color_pos, color_len);
g_string_append(tmp, lastcolor);
g_string_append(tmp, str+pos);
g_free(lastcolor);
if (color_pos > 0) {
lastcolor = g_strndup(str+color_pos, color_len);
g_string_append(tmp, lastcolor);
g_string_append(tmp, str+pos);
g_free(lastcolor);
}
newstr = tmp->str;
g_string_free(tmp, FALSE);