Bug #1400115, Fix segfault when calling curses.panel.userptr()
without prior setting of the userptr.

Will backport.
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 08c5f09..b5f30cb 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -299,6 +299,11 @@
     PyObject *obj;
     PyCursesInitialised; 
     obj = (PyObject *) panel_userptr(self->pan);
+    if (obj == NULL) {
+	PyErr_SetString(PyCursesError, "no userptr set");
+	return NULL;
+    }
+
     Py_INCREF(obj);
     return obj;
 }