summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-07-10 16:25:40 +0200
committerkrzys-h <krzys_h@interia.pl>2014-07-10 16:25:40 +0200
commit106ec014b812c6f5eb93ea30c04b3bba333542dd (patch)
tree72b2fcf4bdc32ec82d3829fd4cab5185e5f9d61a /src/common
parent7b04f673580f0c24aecc103a25c4c4b82da1380f (diff)
downloadcolobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.tar.gz
colobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.tar.bz2
colobot-106ec014b812c6f5eb93ea30c04b3bba333542dd.zip
Fixed texture and script loading
Diffstat (limited to 'src/common')
-rw-r--r--src/common/image.cpp11
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;