fix bluescreen when path not exits
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 4 Jun 2008 14:01:07 +0000 (14:01 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 4 Jun 2008 14:01:07 +0000 (14:01 +0000)
lib/python/Components/FileList.py

index bba846f6abe0bb4f3940dd1db5bef16a79c12ae2..fcd1555f083fdd4cb7706dfc30b3a4d61500e5ae 100644 (file)
@@ -126,13 +126,14 @@ class FileList(MenuList):
                        directories.sort()
                        files.sort()
                else:
-                       files = listdir(directory)
-                       files.sort()
-                       tmpfiles = files[:]
-                       for x in tmpfiles:
-                               if os_path.isdir(directory + x):
-                                       directories.append(directory + x + "/")
-                                       files.remove(x)
+                       if os_path.exists(directory):
+                               files = listdir(directory)
+                               files.sort()
+                               tmpfiles = files[:]
+                               for x in tmpfiles:
+                                       if os_path.isdir(directory + x):
+                                               directories.append(directory + x + "/")
+                                               files.remove(x)
 
                if directory is not None and self.showDirectories and not self.isTop:
                        if directory == self.mount_point: