diff --git a/line_counter.py b/line_counter.py index 1b3109d..df336c8 100644 --- a/line_counter.py +++ b/line_counter.py @@ -180,12 +180,15 @@ class TextFileLineReader: if mode == "index": # Use the provided index directly if index < 0 or index >= len(lines): - print(f"Invalid line index `{index}`. Using index 0.") - index = 0 + print(f"Index `{index}` is out of bounds. Resetting to 0.") + index = 0 # Reset to 0 if out of bounds line_text = lines[index] else: # Automatic mode: use the current_index and increment it - line_text = lines[self.current_index % len(lines)] + if self.current_index >= len(lines): + print("Reached the end of the file. Resetting to 0.") + self.current_index = 0 # Reset to 0 if at the end + line_text = lines[self.current_index] self.current_index += 1 # Increment the index for the next run return (line_text,) diff --git a/pyproject.toml b/pyproject.toml index 7ac2df8..be695b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-line-counter" description = "This custom node package for ComfyUI is designed to streamline your workflow with powerful file-counting capabilities." -version = "1.0.6" +version = "1.0.7" license = {file = "LICENSE"} [project.urls]