From 6f7095ce5b7d71928f57dd8f1f29988bcc07eb02 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 8 Sep 2012 10:05:09 -0400 Subject: [PATCH] Prevent recursive loop --- MediaBrowser.Controller/IO/FileData.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index f5375e71b5..789007be7c 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -25,11 +25,14 @@ namespace MediaBrowser.Controller.IO 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)