1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Don't crash in /NAMES list if /SET names_max_width was too small

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2398 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-02-07 00:34:43 +00:00 committed by cras
parent a3ccfb08d4
commit dbb279a1fe

View File

@ -349,7 +349,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
g_free(format); g_free(format);
if (settings_get_int("names_max_width") > 0 && if (settings_get_int("names_max_width") > 0 &&
max_width > settings_get_int("names_max_width")) settings_get_int("names_max_width") < max_width)
max_width = settings_get_int("names_max_width"); max_width = settings_get_int("names_max_width");
/* remove width of the timestamp from max_width */ /* remove width of the timestamp from max_width */
@ -373,6 +373,12 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
g_free(stripped); g_free(stripped);
} }
if (max_width <= 0) {
/* we should always have at least some space .. if we
really don't, it won't show properly anyway. */
max_width = 10;
}
/* calculate columns */ /* calculate columns */
cols = get_max_column_count(nicklist, get_nick_length, max_width, cols = get_max_column_count(nicklist, get_nick_length, max_width,
settings_get_int("names_max_columns"), settings_get_int("names_max_columns"),