diff options
author | krzys-h <krzys_h@interia.pl> | 2014-07-10 16:25:40 +0200 |
---|---|---|
committer | krzys-h <krzys_h@interia.pl> | 2014-07-10 16:25:40 +0200 |
commit | 106ec014b812c6f5eb93ea30c04b3bba333542dd (patch) | |
tree | 72b2fcf4bdc32ec82d3829fd4cab5185e5f9d61a /src/common/image.cpp | |
parent | 7b04f673580f0c24aecc103a25c4c4b82da1380f (diff) | |
download | colobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.tar.gz colobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.tar.bz2 colobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.zip |
Fixed texture and script loading
Diffstat (limited to 'src/common/image.cpp')
-rw-r--r-- | src/common/image.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/image.cpp b/src/common/image.cpp index aec3d4e..9916c8f 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -382,7 +382,16 @@ bool CImage::Load(const std::string& fileName) m_error = ""; - m_data->surface = IMG_Load_RW(CResourceManager::GetSDLFileHandler(fileName.c_str()), 1); + SDL_RWops* pointer = CResourceManager::GetSDLFileHandler(fileName.c_str()); + if (pointer == nullptr) + { + delete m_data; + m_data = nullptr; + + m_error = "Unable to open file"; + return false; + } + m_data->surface = IMG_Load_RW(pointer, 1); if (m_data->surface == nullptr) { delete m_data; |