Преглед изворни кода

dtoolutil/express: Resolving empty filename should yield no result

See #1140 - I may revert this if someone can demonstrate a compelling use case (for current directory, you can use "." instead), but it seems to have the potential to cause unintuitive behavior.
rdb пре 4 година
родитељ
комит
e9e1bb1bc6
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 4 0
      dtool/src/dtoolutil/dSearchPath.cxx
  2. 4 0
      panda/src/express/virtualFileSystem.cxx

+ 4 - 0
dtool/src/dtoolutil/dSearchPath.cxx

@@ -242,6 +242,10 @@ get_directory(size_t n) const {
  */
 Filename DSearchPath::
 find_file(const Filename &filename) const {
+  if (filename.empty()) {
+    return string();
+  }
+
   if (filename.is_local()) {
     if (_directories.empty()) {
       // Let's say an empty search path is the same as a search path

+ 4 - 0
panda/src/express/virtualFileSystem.cxx

@@ -649,6 +649,10 @@ find_file(const Filename &filename, const DSearchPath &searchpath,
     return get_file(filename, status_only);
   }
 
+  if (filename.empty()) {
+    return nullptr;
+  }
+
   int num_directories = searchpath.get_num_directories();
   for (int i = 0; i < num_directories; ++i) {
     Filename match(searchpath.get_directory(i), filename);