Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit 243ffba

Browse files
committed
break out of while loop if cursor failed to move, to avoid hanging in an endless loop
1 parent 424e72c commit 243ffba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pugdebug/gui/document.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,17 @@ def move_to_line(self, line):
236236
cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor, 0)
237237

238238
block_number = cursor.blockNumber()
239+
239240
while block_number < line:
240-
cursor.movePosition(
241+
cursor_moved = cursor.movePosition(
241242
QTextCursor.NextBlock,
242243
QTextCursor.MoveAnchor,
243244
1
244245
)
246+
247+
if cursor_moved is False:
248+
break
249+
245250
block_number = cursor.blockNumber()
246251

247252
self.setTextCursor(cursor)

0 commit comments

Comments
 (0)