Commits

Anonymous committed 608546a

Surface.set_colorkey() noargs fix

  • Participants
  • Parent commits 544b3e6

Comments (0)

Files changed (2)

 # BREAK = change breaks existing code
 # BUG   = fixed a bug that was crashing
 
+Feb 14, 2001
+	fixed Surface.set_colorkey() with no args [BUG]
+
 Feb 13, 2001
 	fixed return rect from line drawing routines
 	small fix when drawing horizontal lines

File src/surface.c

 	PyObject* rgba_obj = NULL;
 	Uint8 rgba[4];
 	int result;
-
 	if(!PyArg_ParseTuple(args, "|Oi", &rgba_obj, &flags))
 		return NULL;
 
-	if(PyInt_Check(rgba_obj))
-		color = (Uint32)PyInt_AsLong(rgba_obj);
-	else if(RGBAFromObj(rgba_obj, rgba))
-		color = SDL_MapRGBA(surf->format, rgba[0], rgba[1], rgba[2], rgba[3]);
-	else
-		return RAISE(PyExc_TypeError, "invalid color argument");
+	if(rgba_obj)
+	{
+		if(PyInt_Check(rgba_obj))
+			color = (Uint32)PyInt_AsLong(rgba_obj);
+		else if(RGBAFromObj(rgba_obj, rgba))
+			color = SDL_MapRGBA(surf->format, rgba[0], rgba[1], rgba[2], rgba[3]);
+		else
+			return RAISE(PyExc_TypeError, "invalid color argument");
+	}
 
 	if(PyTuple_Size(args) > 0)
 		flags |= SDL_SRCCOLORKEY;