From d2f1d05a06cbfe8bf3e042d728eca8d2d39250d9 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 2 Jun 2021 13:46:43 -0700 Subject: [PATCH] handle cases where authenticationURL and authenticationExpiryTime don't exist --- controller/EmbeddedNetworkController.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index b4eb28b87..aea132596 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -1325,8 +1325,16 @@ void EmbeddedNetworkController::_request( member["lastAuthorizedCredential"] = autoAuthCredential; } - const int64_t authenticationExpiryTime = member["authenticationExpiryTime"]; - const std::string authenticationURL = member["authenticationURL"]; + + int64_t authenticationExpiryTime = 0; + if (!member["authenticationExpiryTime"].is_null()) { + authenticationExpiryTime = member["authenticationExpiryTime"]; + } + + std::string authenticationURL = ""; + if (!member["authenticationURL"].is_null()) { + authenticationURL = member["authenticationURL"]; + } if (authorized) { // Update version info and meta-data if authorized and if this is a genuine request