Skip to content

Commit bdb0776

Browse files
committed
Update error message
1 parent 98571fe commit bdb0776

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src_c/surface.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,14 +1590,14 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
15901590
static SDL_Surface *
15911591
pg_DisplayFormat(SDL_Surface *surface)
15921592
{
1593-
if (!pg_GetDefaultConvertFormat()) {
1594-
SDL_SetError("No convert format has been set, try display.set_mode()"
1595-
// " or Window.get_surface()"
1596-
// (uncomment when Window API is published)
1597-
);
1593+
SDL_PixelFormat *default_format = pg_GetDefaultConvertFormat();
1594+
if (!default_format) {
1595+
SDL_SetError(
1596+
"No convert format has been set, try display.set_mode()"
1597+
" or Window.get_surface().");
15981598
return NULL;
15991599
}
1600-
return PG_ConvertSurface(surface, pg_GetDefaultConvertFormat());
1600+
return PG_ConvertSurface(surface, default_format);
16011601
}
16021602

16031603
static SDL_Surface *
@@ -1611,10 +1611,9 @@ pg_DisplayFormatAlpha(SDL_Surface *surface)
16111611
Uint32 bmask = 0x000000ff;
16121612

16131613
if (!pg_GetDefaultConvertFormat()) {
1614-
SDL_SetError("No convert format has been set, try display.set_mode()"
1615-
// " or Window.get_surface()"
1616-
// (uncomment when Window API is published)
1617-
);
1614+
SDL_SetError(
1615+
"No convert format has been set, try display.set_mode()"
1616+
" or Window.get_surface().");
16181617
return NULL;
16191618
}
16201619
dformat = pg_GetDefaultConvertFormat();

0 commit comments

Comments
 (0)