Browse Source

better safety

logicp 5 years ago
parent
commit
cd49014426
1 changed files with 2 additions and 2 deletions
  1. 2 2
      headers/util.hpp

+ 2 - 2
headers/util.hpp

@@ -305,7 +305,7 @@ bool isStopOperation(const char* data) {
 bool isNewSession(const char* data) {
     Document d;
     d.Parse(data);
-    if (d.HasMember("message")) {
+    if (d.IsObject() && d.HasMember("message")) {
         return strcmp(d["message"].GetString(), "New Session") == 0;
     }
     return false;
@@ -314,7 +314,7 @@ bool isNewSession(const char* data) {
 bool serverWaitingForFile(const char* data) {
     Document d;
     d.Parse(data);
-    if (d.HasMember("message")) {
+    if (d.IsObject() && d.HasMember("message")) {
         return strcmp(d["message"].GetString(), "File Ready") == 0;
     }
     return false;