From cedef65ab67b798e23f5592259ae225fd6dea363 Mon Sep 17 00:00:00 2001 From: Isak Naslund <Isak.Naslund@burohappold.com> Date: Wed, 1 Sep 2021 09:36:57 +0200 Subject: [PATCH] Adding nullcheck for process --- GSA_Adapter/AdapterActions/Execute.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GSA_Adapter/AdapterActions/Execute.cs b/GSA_Adapter/AdapterActions/Execute.cs index b7429709..48815cbd 100644 --- a/GSA_Adapter/AdapterActions/Execute.cs +++ b/GSA_Adapter/AdapterActions/Execute.cs @@ -155,7 +155,12 @@ public bool RunCommand(Exit command) } using (System.Diagnostics.Process gsaProcess = System.Diagnostics.Process.GetProcessById(m_gsaCom.ProcessID())) - { + { + if (gsaProcess == null) + { + Engine.Reflection.Compute.RecordError("Could not find GSA process. Unable to exit application,"); + return false; + } string name = gsaProcess.ProcessName; if (!name.ToUpper().Contains("GSA")) {