diff --git a/src/main.cpp b/src/main.cpp index 9f4ba82..1b46bf0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,13 +173,15 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) { is_currently_preview = false; } } - } else if (strcmp(doc["update-type"], "Exiting") == 0) { - Serial.println("[OBS] quit"); - is_currently_preview = false; - is_currently_live = false; - } else if (strcmp(doc["update-type"], "StudioModeSwitched") == 0 && !doc["new-state"]) { - Serial.println("[OBS] studio mode disabled"); - is_currently_preview = false; + } else if (doc.containsKey("update-type")) { + if (strcmp(doc["update-type"], "Exiting") == 0) { + Serial.println("[OBS] quit"); + is_currently_preview = false; + is_currently_live = false; + } else if (strcmp(doc["update-type"], "StudioModeSwitched") == 0 && !doc["new-state"]) { + Serial.println("[OBS] studio mode disabled"); + is_currently_preview = false; + } } if (is_currently_live) {