X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_slkset.c;h=e19f88e60ac4314090a9b334d9715ddd1178d9ac;hp=9379b36322e2a12ddbbe4b64ef47b7d7d0b92263;hb=491a3f08b795f494ae17179338c31a11b18fd433;hpb=28e9f9700c7bf7280cf9d71304a880b570a0b4ea;ds=sidebyside diff --git a/ncurses/base/lib_slkset.c b/ncurses/base/lib_slkset.c index 9379b363..e19f88e6 100644 --- a/ncurses/base/lib_slkset.c +++ b/ncurses/base/lib_slkset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -44,12 +44,12 @@ #endif #endif -MODULE_ID("$Id: lib_slkset.c,v 1.16 2006/12/17 19:47:09 tom Exp $") +MODULE_ID("$Id: lib_slkset.c,v 1.17 2007/10/13 20:08:46 tom Exp $") NCURSES_EXPORT(int) slk_set(int i, const char *astr, int format) { - SLK *slk = SP->_slk; + SLK *slk; int offset; int numchrs; int numcols; @@ -59,7 +59,12 @@ slk_set(int i, const char *astr, int format) T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format)); - if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) + if (SP == 0 + || (slk = SP->_slk) == 0 + || i < 1 + || i > slk->labcnt + || format < 0 + || format > 2) returnCode(ERR); if (str == NULL) str = "";