eric6/WebBrowser/Session/SessionManager.py

changeset 8243
cc717c2ae956
parent 8218
7c09585bd960
--- 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):
         """

eric ide

mercurial