summaryrefslogtreecommitdiff
path: root/src/fe-common/core/fe-channels.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-02-07 00:34:43 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-02-07 00:34:43 +0000
commitdbb279a1fe38d41e8af1497e2ff83d8092462efe (patch)
tree717c5fce69849419f2566b4d328ad84e6bc22b29 /src/fe-common/core/fe-channels.c
parenta3ccfb08d4327a623bccd50ba38f84194245d3cc (diff)
downloadirssi-dbb279a1fe38d41e8af1497e2ff83d8092462efe.zip
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
Diffstat (limited to 'src/fe-common/core/fe-channels.c')
-rw-r--r--src/fe-common/core/fe-channels.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index 83638ddf..fe41ea30 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -349,7 +349,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
g_free(format);
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");
/* 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);
}
+ 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 */
cols = get_max_column_count(nicklist, get_nick_length, max_width,
settings_get_int("names_max_columns"),