diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 256894d49..fbe41d6a8 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -555,6 +555,10 @@ class CommandDispatcher: tabbed_browser = self._new_tabbed_browser( private=self._tabbed_browser.private) else: + if win_id not in objreg.window_registry: + raise cmdexc.CommandError( + "There's no window with id {}!".format(win_id)) + tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index e0728f10d..be82d85bd 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1058,6 +1058,11 @@ Feature: Tab management And I run :tab-give Then the error "Cannot detach from a window with only one tab" should be shown + Scenario: Give a tab to a window ID that does not exist + When I open data/hello.txt + And I run :tab-give 99 + Then the error "There's no window with id 99!" should be shown + # Other Scenario: Using :tab-next after closing last tab (#1448)