FastLED 3.10.6
Loading...
Searching...
No Matches

◆ set() [4/11]

void fl::json::set ( const fl::string & key,
const json & value )
inline

Definition at line 866 of file json.h.

868 {
869 if (!mValue || !mValue->is_object()) {
871 }
872 // FastLED#3588: make_shared degrades to an empty shared_ptr under
873 // OOM, so mValue can be null here — dereferencing it would read
874 // through null. Degrade gracefully (the set becomes a no-op).
875 if (!mValue) {
876 return;
877 }
878 // Directly assign the value to the object without going through json::operator[]
879 auto objPtr = mValue->data.ptr<json_object>();
880 if (objPtr) {
881 // Create or update the entry directly
882 if (value.mValue) {
883 (*objPtr)[key] = value.mValue;
884 } else {
885 // If value has null mValue, create a null json_value
886 (*objPtr)[key] = fl::make_shared<json_value>(nullptr);
887 }
fl::shared_ptr< json_value > mValue
Definition json.h:263
T value() const FL_NO_EXCEPT
Definition json.h:497
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:414
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
Definition types.h:55

References json(), fl::FL_NO_EXCEPT, fl::make_shared(), mValue, and value().

Referenced by autoresearch::flex_io::buildDeviceInfo(), fl::crgbToJson(), fl::deviceJson(), fl::WLED::getPlaylistConfig(), fl::WLED::getState(), fl::Rpc::handle(), fl::detail::makeJsonRpcError(), fl::Remote::processRpc(), fl::Remote::reportError(), fl::Remote::reportError(), fl::net::http::HttpStreamTransport::rpc(), fl::net::http::HttpStreamTransport::rpcStream(), fl::Rpc::schema(), fl::ResponseSend::sendFinal(), fl::net::http::HttpStreamTransport::sendHeartbeat(), set(), setup(), fl::RpcResult::to_json(), and fl::ScreenMap::toJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: