Revert change to _count

Adds a specific check for only -1 in _current_index
This commit is contained in:
bosshogg 2024-10-16 18:40:44 +02:00 committed by Chad Kouse
parent dbfd9c1f2e
commit b7bb774bee
No known key found for this signature in database
GPG Key ID: 2BBC602A2578C7A2
1 changed files with 2 additions and 5 deletions

View File

@ -62,10 +62,7 @@ class CommandDispatcher:
def _count(self) -> int:
"""Convenience method to get the widget count."""
count = self._tabbed_browser.widget.count()
if count < 0:
raise cmdutils.CommandError("No WebView available yet!")
return count
return self._tabbed_browser.widget.count()
def _set_current_index(self, idx):
"""Convenience method to set the current widget index."""
@ -75,7 +72,7 @@ class CommandDispatcher:
def _current_index(self):
"""Convenience method to get the current widget index."""
current_index = self._tabbed_browser.widget.currentIndex()
if current_index < 0:
if current_index == -1:
raise cmdutils.CommandError("No WebView available yet!")
return current_index