Initialize SDL_image library before using it.

This commit is contained in:
Marco Schlumpp 2014-02-26 17:21:20 +01:00
parent 07d41d06dc
commit 3e6353b999

View File

@ -114,6 +114,11 @@ namespace spades {
virtual SDL_Surface *LoadSdlImage(const std::string& data) {
StringSdlRWops ops(data);
int flags = IMG_INIT_PNG|IMG_INIT_JPG;
int initted = IMG_Init(flags);
if((initted & flags) != flags) {
SPRaise("IMG_Init failed: %s", IMG_GetError());
}
auto *s = IMG_Load_RW(ops, 0);
if(s == nullptr) {
SPRaise("IMG_Load_RW failed: %s", IMG_GetError());