Skip to content

Commit

Permalink
Initialize SDL_image library before using it.
Browse files Browse the repository at this point in the history
  • Loading branch information
mschlumpp committed Feb 26, 2014
1 parent 07d41d0 commit 3e6353b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Core/SdlImageReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 3e6353b

Please sign in to comment.