- svn:eol-style = native fixes
[supertux.git] / src / addon / addon_manager.cpp
index 4a783d8..cf7ab80 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sstream>
 #include <stdexcept>
+#include <algorithm>
 #include <cstdlib>
 #include <list>
 #include <physfs.h>
@@ -385,7 +386,11 @@ AddonManager::load_addons()
 
       // make sure it looks like an infoFile
       static const std::string infoExt = ".nfo";
-      if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0) continue;
+      if (potentialInfoFileName.length() <= infoExt.length())
+        continue;
+
+      if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0)
+        continue;
 
       // make sure it's in the current archive
       std::string infoFileDir = PHYSFS_getRealDir(potentialInfoFileName.c_str());