Fix curl include paths that were messed up in 5778. The other part of the fix a C...
[supertux.git] / src / addon / addon_manager.cpp
index 4a783d8..1327f1c 100644 (file)
 
 #include <sstream>
 #include <stdexcept>
+#include <algorithm>
 #include <cstdlib>
 #include <list>
 #include <physfs.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "addon/addon_manager.hpp"
+#include "addon/addon.hpp"
 #include "config.h"
 #include "log.hpp"
 #include "lisp/parser.hpp"
 #include "lisp/lisp.hpp"
 #include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
 #include "physfs/physfs_stream.hpp"
 
 #ifdef HAVE_LIBCURL
@@ -385,7 +388,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());