Skip to content

Commit ee8d87f

Browse files
committed
Add fix for the error found by hypothesis
1 parent 5849ec2 commit ee8d87f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

isort/parse.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
519519
if comments and attach_comments_to is not None:
520520
attach_comments_to.extend(comments)
521521

522-
if "," in import_string.split(just_imports[-1])[-1]:
522+
if (
523+
just_imports
524+
and just_imports[-1]
525+
and "," in import_string.split(just_imports[-1])[-1]
526+
):
523527
trailing_commas.add(import_from)
524528
else:
525529
if comments and attach_comments_to is not None:

0 commit comments

Comments
 (0)