PDCurses
PDCurses copied to clipboard
SDL_GetError() returns "Parameter 'src' is invalid" after call to initscr() for sdl2
In this code path, SDL_GetError returns "Parameter 'src' is invalid" after the call to initscr.
The error comes from this code: https://github.com/wmcbrine/PDCurses/blob/f2d31a2633eb042f7bf1f79cba81522915a04579/sdl2/pdcscrn.c#L233-L237
I guess it's not valid to call SDL_LoadBMP with NULL. Obviously I can work-around this by calling SDL_ClearError immediately after the call to initscr()
but I think it would be cleaner long-term if this call causing an invalid error could be avoided in the first place.
I found this out because I started annotating all of my calls to SDL with checks using SDL_GetError(), and this came up.
Eh, the point of bname ? bname : "pdcback.bmp"
is precisely to avoid passing a NULL
to SDL_LoadBMP
.
Your right, I misunderstood what was happening yesterday. It's falling back to "pdcback.bmp" but that file doesn't exist, so SDL calls SDL_SetError which lead to the issue.