Skip to content

Commit fb13521

Browse files
committed
Fix
1 parent d2b3c1d commit fb13521

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

data_structures/linked_list/merge_sort_linked_list.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def get_middle(head: Node | None) -> Node | None:
4747
slow: Node | None = head
4848
fast: Node | None = head
4949
while fast is not None and fast.next is not None:
50+
if slow is None: # This should never happen, but it satisfies the type checker
51+
return None
5052
slow = slow.next
5153
fast = fast.next.next
5254

0 commit comments

Comments
 (0)