diff Mac/Python/macglue.c @ 11591:1131bfa1ad99 legacy-trunk

Added PyMac_BuildOptStr255, which returns None on a null pointer.
author Jack Jansen <jack.jansen@cwi.nl>
date Fri, 17 Dec 1999 17:15:50 +0000
parents c042e4140f1e
children 489483b65b3a
line wrap: on
line diff
--- a/Mac/Python/macglue.c	Fri Dec 17 17:14:28 1999 +0000
+++ b/Mac/Python/macglue.c	Fri Dec 17 17:15:50 1999 +0000
@@ -826,6 +826,20 @@
 PyObject *
 PyMac_BuildStr255(Str255 s)
 {
+	if ( s == NULL ) {
+		PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL");
+		return NULL;
+	}
+	return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
+}
+
+PyObject *
+PyMac_BuildOptStr255(Str255 s)
+{
+	if ( s == NULL ) {
+		Py_INCREF(Py_None);
+		return Py_None;
+	}
 	return PyString_FromStringAndSize((char *)&s[1], (int)s[0]);
 }