X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftabs.c;fp=progs%2Ftabs.c;h=bded0b04b259812db51be662d6305ac4a7dbc00c;hp=07790f831d9df89d2361103d5aed75e473fa6d48;hb=98d8891f42d8acac5c2ade39d163f386057a22e4;hpb=da2e96ef7073a13477fe57144926dd159e6089c0 diff --git a/progs/tabs.c b/progs/tabs.c index 07790f83..bded0b04 100644 --- a/progs/tabs.c +++ b/progs/tabs.c @@ -37,7 +37,7 @@ #define USE_LIBTINFO #include -MODULE_ID("$Id: tabs.c,v 1.24 2012/10/27 19:53:53 tom Exp $") +MODULE_ID("$Id: tabs.c,v 1.25 2012/11/18 01:21:47 tom Exp $") static void usage(void) GCC_NORETURN; @@ -116,22 +116,24 @@ decode_tabs(const char *tab_list) } } - /* - * If there is only one value, then it is an option such as "-8". - */ - if ((n == 0) && (value > 0)) { - int step = value; - while (n < max_cols - 1) { - result[n++] = value; - value += step; + if (result != 0) { + /* + * If there is only one value, then it is an option such as "-8". + */ + if ((n == 0) && (value > 0)) { + int step = value; + while (n < max_cols - 1) { + result[n++] = value; + value += step; + } } - } - /* - * Add the last value, if any. - */ - result[n++] = value + prior; - result[n] = 0; + /* + * Add the last value, if any. + */ + result[n++] = value + prior; + result[n] = 0; + } return result; }