mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-23 11:42:09 +03:00
Ticket #1574: mc crashes while setting tty colors
MC crashes if color sring containes an empty color name like following: base_color=normal=,default: Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
484a076071
commit
ce57055a3a
@ -75,14 +75,21 @@ configure_colors_string (const char *the_color_string)
|
|||||||
p = color_strings;
|
p = color_strings;
|
||||||
|
|
||||||
while ((p != NULL) && (*p != NULL)) {
|
while ((p != NULL) && (*p != NULL)) {
|
||||||
char **cfb; /* color, fore, back*/
|
char **cfb; /* color, fore, back */
|
||||||
/* cfb[0] - entry name
|
/* cfb[0] - entry name
|
||||||
* cfb[1] - fore color
|
* cfb[1] - fore color
|
||||||
* cfb[20 - back color
|
* cfb[2] - back color
|
||||||
*/
|
*/
|
||||||
char *e;
|
char *e;
|
||||||
|
|
||||||
cfb = g_strsplit_set (*p, "=,", 3);
|
cfb = g_strsplit_set (*p, "=,", 3);
|
||||||
|
p++;
|
||||||
|
|
||||||
|
if (cfb[0] == NULL) {
|
||||||
|
g_strfreev (cfb);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* append '=' to the entry name */
|
/* append '=' to the entry name */
|
||||||
e = g_strdup_printf ("%s=", cfb[0]);
|
e = g_strdup_printf ("%s=", cfb[0]);
|
||||||
g_free (cfb[0]);
|
g_free (cfb[0]);
|
||||||
@ -102,7 +109,6 @@ configure_colors_string (const char *the_color_string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (cfb);
|
g_strfreev (cfb);
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (color_strings);
|
g_strfreev (color_strings);
|
||||||
|
Loading…
Reference in New Issue
Block a user