]> git.0d.be Git - django-panik-nonstop.git/blobdiff - nonstop/models.py
check file is defined before checking it exists on the filesystem
[django-panik-nonstop.git] / nonstop / models.py
index b3f459ebe69e0cf25fac50db0370fb5cb2cb2180..c4a7b6ee01ba5b87d8c556ea77d9067caf8dd89e 100644 (file)
@@ -83,8 +83,11 @@ class Track(models.Model):
         return None
 
     def file_exists(self):
+        file_path = self.file_path()
+        if not file_path:
+            return False
         try:
-            return os.path.exists(self.file_path())
+            return os.path.exists(file_path)
         except AttributeError:
             return False