File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ inline ArrayImpl::iterator ArrayImpl::at(size_t index) const {
2020}
2121
2222inline VariantData* ArrayImpl::addElement () {
23+ if (!data_)
24+ return nullptr ;
25+ ARDUINOJSON_ASSERT (resources_ != nullptr );
2326 auto slot = resources_->allocVariant ();
2427 if (!slot)
2528 return nullptr ;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ inline CollectionImpl::iterator CollectionImpl::createIterator() const {
3232}
3333
3434inline void CollectionImpl::appendOne (Slot<VariantData> slot) {
35+ ARDUINOJSON_ASSERT (data_ != nullptr );
36+ ARDUINOJSON_ASSERT (resources_ != nullptr );
37+
3538 if (data_->tail != NULL_SLOT) {
3639 auto tail = resources_->getVariant (data_->tail );
3740 tail->setNext (slot.id ());
@@ -44,6 +47,9 @@ inline void CollectionImpl::appendOne(Slot<VariantData> slot) {
4447
4548inline void CollectionImpl::appendPair (Slot<VariantData> key,
4649 Slot<VariantData> value) {
50+ ARDUINOJSON_ASSERT (data_ != nullptr );
51+ ARDUINOJSON_ASSERT (resources_ != nullptr );
52+
4753 key->setNext (value.id ());
4854
4955 if (data_->tail != NULL_SLOT) {
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ inline void ObjectImpl::removeMember(TAdaptedString key) {
4747
4848template <typename TAdaptedString>
4949inline VariantData* ObjectImpl::addMember (TAdaptedString key) {
50+ if (!data_)
51+ return nullptr ;
52+ ARDUINOJSON_ASSERT (resources_ != nullptr );
53+
5054 auto keySlot = resources_->allocVariant ();
5155 if (!keySlot)
5256 return nullptr ;
@@ -64,6 +68,10 @@ inline VariantData* ObjectImpl::addMember(TAdaptedString key) {
6468}
6569
6670inline VariantData* ObjectImpl::addPair (VariantData** value) {
71+ if (!data_)
72+ return nullptr ;
73+ ARDUINOJSON_ASSERT (resources_ != nullptr );
74+
6775 auto keySlot = resources_->allocVariant ();
6876 if (!keySlot)
6977 return nullptr ;
You can’t perform that action at this time.
0 commit comments