summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 448e7f80..5e3f3bc7 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -275,6 +275,13 @@ ResourceManager::getSprite(const std::string &path, int variant)
return dynamic_cast<SpriteDef*>(resIter->second);
}
+ // FIXME: modify SpriteDef so that it gracefully fails on missing sprite.
+ if (!exists(path) || isDirectory(path))
+ {
+ logger->log("Failed to load file: %s", path.c_str());
+ return NULL;
+ }
+
SpriteDef *sprite = new SpriteDef(idPath, path, variant);
sprite->incRef();
mResources[idPath] = sprite;