small issues:

- added a guard so no invalid(0)-handler is deleted at shutdown

- "if (s_image_map[extension] == 0)" -> creates an entry for sure, we
  dont want this.
This commit is contained in:
mathias 2005-01-02 06:21:45 +00:00
parent 1be23b544f
commit c7a3200730

View file

@ -66,8 +66,10 @@ void Image::shutdown() {
// for more than one type // for more than one type
ImageMap::iterator it = s_image_map.begin(); ImageMap::iterator it = s_image_map.begin();
ImageMap::iterator it_end = s_image_map.end(); ImageMap::iterator it_end = s_image_map.end();
for (; it != it_end; it++) for (; it != it_end; it++) {
handlers.insert(it->second); if (it->second)
handlers.insert(it->second);
}
// free the unique handlers // free the unique handlers
std::set<ImageBase*>::iterator handler_it = handlers.begin(); std::set<ImageBase*>::iterator handler_it = handlers.begin();
@ -89,7 +91,7 @@ PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
std::string extension(StringUtil::toUpper(StringUtil::findExtension(filename))); std::string extension(StringUtil::toUpper(StringUtil::findExtension(filename)));
// valid handle? // valid handle?
if (s_image_map[extension] == 0) if (s_image_map.find(extension) == s_image_map.end())
return false; return false;
// load file // load file