summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
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;