Browse Source

Prevent recursive loop

LukePulverenti Luke Pulverenti luke pulverenti 12 years ago
parent
commit
6f7095ce5b
1 changed files with 7 additions and 4 deletions
  1. 7 4
      MediaBrowser.Controller/IO/FileData.cs

+ 7 - 4
MediaBrowser.Controller/IO/FileData.cs

@@ -25,11 +25,14 @@ namespace MediaBrowser.Controller.IO
 
 
             if (handle == INVALID_HANDLE_VALUE && !Path.HasExtension(path))
             if (handle == INVALID_HANDLE_VALUE && !Path.HasExtension(path))
             {
             {
-                Logger.LogInfo("Handle came back invalid for {0}. Since this is a directory we'll try appending \\*.", path);
-                
-                FindClose(handle);
+                if (!path.EndsWith("*"))
+                {
+                    Logger.LogInfo("Handle came back invalid for {0}. Since this is a directory we'll try appending \\*.", path);
+
+                    FindClose(handle);
 
 
-                handle = FindFirstFile(Path.Combine(path, "*"), out data);
+                    handle = FindFirstFile(Path.Combine(path, "*"), out data);
+                }
             }
             }
 
 
             if (handle == IntPtr.Zero)
             if (handle == IntPtr.Zero)