Skip to content

Commit f7888a8

Browse files
committed
Fixed crash
1 parent 5305db0 commit f7888a8

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

manager/manager/manager.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,14 +787,28 @@ def process_message(self, message):
787787
self.consumer.send_message(message.response(response))
788788

789789
def on_pause(self, msg):
790-
proc = psutil.Process(self.application_process.pid)
791-
proc.suspend()
792-
self.pause_sim()
790+
if self.application_process is not None:
791+
try:
792+
proc = psutil.Process(self.application_process.pid)
793+
proc.suspend()
794+
self.pause_sim()
795+
except Exception as e:
796+
LogManager.logger.exception("Error suspending process")
797+
else:
798+
LogManager.logger.warning("Application process was None during pause. Calling termination.")
799+
self.on_terminate_application(msg)
793800

794801
def on_resume(self, msg):
795-
proc = psutil.Process(self.application_process.pid)
796-
proc.resume()
797-
self.unpause_sim()
802+
if self.application_process is not None:
803+
try:
804+
proc = psutil.Process(self.application_process.pid)
805+
proc.resume()
806+
self.unpause_sim()
807+
except Exception as e:
808+
LogManager.logger.exception("Error suspending process")
809+
else:
810+
LogManager.logger.warning("Application process was None during resume. Calling termination.")
811+
self.on_terminate_application(msg)
798812

799813
def pause_sim(self):
800814
if self.visualization_type in ["gzsim_rae", "bt_studio_gz"]:

0 commit comments

Comments
 (0)