From 24eb05f83ede83fe467f9f4699279ea454a2bc35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 4 Jan 2020 17:56:25 +0100 Subject: [PATCH] check file is defined before checking it exists on the filesystem --- nonstop/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nonstop/models.py b/nonstop/models.py index b3f459e..c4a7b6e 100644 --- a/nonstop/models.py +++ b/nonstop/models.py @@ -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 -- 2.39.2