Skip to content

Commit a226185

Browse files
relax convert conditions
1 parent dfaa76e commit a226185

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src_c/surface.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,13 +1415,16 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
14151415
Uint8 key_r, key_g, key_b, key_a = 255;
14161416
int has_colorkey = SDL_FALSE;
14171417

1418-
if (!SDL_WasInit(SDL_INIT_VIDEO))
1419-
return RAISE(pgExc_SDLError,
1420-
"cannot convert without pygame.display initialized");
1421-
14221418
if (!PyArg_ParseTuple(args, "|Oi", &argobject, &flags))
14231419
return NULL;
14241420

1421+
1422+
if (!argobject && !SDL_WasInit(SDL_INIT_VIDEO))
1423+
return RAISE(pgExc_SDLError,
1424+
"cannot convert without format "
1425+
"when pygame.display is not initialized");
1426+
1427+
14251428
SURF_INIT_CHECK(surf)
14261429

14271430
pgSurface_Prep(self);

0 commit comments

Comments
 (0)