#6243: fix segfault when keyname() returns a NULL pointer.

Bug noted by Trundle, patched by Trundle and Jerry Chen.
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 1b3489c..2f7c04c 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -257,6 +257,10 @@
         if curses.LINES != lines - 1 or curses.COLS != cols + 1:
             raise RuntimeError, "Expected resizeterm to update LINES and COLS"
 
+def test_issue6243(stdscr):
+    curses.ungetch(1025)
+    stdscr.getkey()
+
 def main(stdscr):
     curses.savetty()
     try:
@@ -264,6 +268,7 @@
         window_funcs(stdscr)
         test_userptr_without_set(stdscr)
         test_resize_term(stdscr)
+        test_issue6243(stdscr)
     finally:
         curses.resetty()