--- ncurses/base/lib_ungetch.c 2002-08-24 15:08:48.000000000 -0700 +++ ncurses/base/lib_ungetch.c 2008-03-25 13:49:35.000000000 -0700 @@ -61,6 +61,10 @@ { int rc = ERR; + if (!sp) { + returnCode(ERR); + } + if (tail != -1) { if (head == -1) { head = 0;