• Why I always get the error RuntimeError: generator

Question related to mission Merge Intervals (iterator version)

 

I used the following code to check the empty input if intervals==[]: print("error") return But when do check it always get the error

RuntimeError: generator raised StopIteration, ?, ? Fail: merge_intervals([])

Could you please let me know what I am wrong? Thanks in advance.