From 57b5a33fbbbaceb7ac562145712a435fcd2b1a0a Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 29 Mar 2017 12:32:59 -0700 Subject: [PATCH] Fix bug preventing default from being set to null if already set to an integer. --- controller/EmbeddedNetworkController.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index ce56e906f..3be55d8ec 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -1018,9 +1018,10 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST( json ntag = json::object(); const uint64_t tagId = OSUtils::jsonInt(tag["id"],0ULL); ntag["id"] = tagId; - if (tag.find("default") == tag.end()) - ntag["default"] = json(); - else ntag["default"] = OSUtils::jsonInt(tag["default"],0ULL); + json &dfl = tag["default"]; + if (dfl.is_null()) + ntag["default"] = dfl; + else ntag["default"] = OSUtils::jsonInt(dfl,0ULL); ntags[tagId] = ntag; } }