Skip to content

Commit

Permalink
Fix check_suffix() (ultralytics#4712)
Browse files Browse the repository at this point in the history
Fix a bug when `file=''`
  • Loading branch information
glenn-jocher committed Sep 8, 2021
1 parent b2d64cd commit 11673b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def check_imshow():

def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
# Check file(s) for acceptable suffixes
if any(suffix):
if file and suffix:
if isinstance(suffix, str):
suffix = [suffix]
for f in file if isinstance(file, (list, tuple)) else [file]:
Expand All @@ -258,7 +258,7 @@ def check_yaml(file, suffix=('.yaml', '.yml')):

def check_file(file, suffix=''):
# Search/download file (if necessary) and return path
check_suffix(file, suffix)
check_suffix(file, suffix) # optional
file = str(file) # convert to str()
if Path(file).is_file() or file == '': # exists
return file
Expand Down

0 comments on commit 11673b9

Please sign in to comment.