diff -r aa713ac50c0d -r cc717c2ae956 eric6/WebBrowser/Session/SessionManager.py --- a/eric6/WebBrowser/Session/SessionManager.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/WebBrowser/Session/SessionManager.py Thu Apr 15 18:11:24 2021 +0200 @@ -10,6 +10,7 @@ import os import json import functools +import contextlib from PyQt5.QtCore import ( pyqtSlot, pyqtSignal, Qt, QObject, QTimer, QDir, QFile, QFileInfo, @@ -466,14 +467,11 @@ if "CurrentWindowIndex" in sessionData: currentWindowIndex = sessionData["CurrentWindowIndex"] - try: + with contextlib.suppress(IndexError): currentWindow = ( WebBrowserWindow.mainWindows()[currentWindowIndex] ) QTimer.singleShot(0, lambda: currentWindow.raise_()) - except IndexError: - # ignore it - pass def renameSession(self, sessionFilePath, flags=0): """