diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index ccb859163..0fbbba19d 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -32,10 +32,12 @@ def replace_variables(win_id, arglist): args = [] tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) - url = tabbed_browser.current_url().toString(QUrl.FullyEncoded | - QUrl.RemovePassword) for arg in arglist: if arg == '{url}': + # Note we have to do this in here as the user gets an error message + # by current_url if no URL is open yet. + url = tabbed_browser.current_url().toString(QUrl.FullyEncoded | + QUrl.RemovePassword) args.append(url) else: args.append(arg)