]> git.0d.be Git - django-panik-nonstop.git/commitdiff
check file is defined before checking it exists on the filesystem
authorFrédéric Péters <fpeters@0d.be>
Sat, 4 Jan 2020 16:56:25 +0000 (17:56 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sat, 4 Jan 2020 16:56:25 +0000 (17:56 +0100)
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