From 43bdfbb4112feae486f6f19f7fa18a89f9068bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Sat, 1 Aug 2020 19:31:27 +0200 Subject: [PATCH] SEBWIN-405: Fixed issue with parsing of server instruction. --- SafeExamBrowser.Server/ServerProxy.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/SafeExamBrowser.Server/ServerProxy.cs b/SafeExamBrowser.Server/ServerProxy.cs index 48a01ca0..af4a1b9f 100644 --- a/SafeExamBrowser.Server/ServerProxy.cs +++ b/SafeExamBrowser.Server/ServerProxy.cs @@ -315,9 +315,12 @@ namespace SafeExamBrowser.Server var token = ("SEBConnectionToken", connectionToken); var success = TryExecute(HttpMethod.Post, api.PingEndpoint, out var response, content, contentType, authorization, token); - if (success && TryParseInstruction(response.Content, out var instruction) && instruction == "SEB_QUIT") + if (success) { - Task.Run(() => TerminationRequested?.Invoke()); + if (TryParseInstruction(response.Content, out var instruction) && instruction == "SEB_QUIT") + { + Task.Run(() => TerminationRequested?.Invoke()); + } } else { @@ -445,7 +448,10 @@ namespace SafeExamBrowser.Server { var json = JsonConvert.DeserializeObject(Extract(content)) as JObject; - instruction = json["instruction"].Value(); + if (json != default(JObject)) + { + instruction = json["instruction"].Value(); + } } catch (Exception e) {