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 {
20
20
}
21
21
22
22
inline VariantData* ArrayImpl::addElement () {
23
+ if (!data_)
24
+ return nullptr ;
25
+ ARDUINOJSON_ASSERT (resources_ != nullptr );
23
26
auto slot = resources_->allocVariant ();
24
27
if (!slot)
25
28
return nullptr ;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ inline CollectionImpl::iterator CollectionImpl::createIterator() const {
32
32
}
33
33
34
34
inline void CollectionImpl::appendOne (Slot<VariantData> slot) {
35
+ ARDUINOJSON_ASSERT (data_ != nullptr );
36
+ ARDUINOJSON_ASSERT (resources_ != nullptr );
37
+
35
38
if (data_->tail != NULL_SLOT) {
36
39
auto tail = resources_->getVariant (data_->tail );
37
40
tail->setNext (slot.id ());
@@ -44,6 +47,9 @@ inline void CollectionImpl::appendOne(Slot<VariantData> slot) {
44
47
45
48
inline void CollectionImpl::appendPair (Slot<VariantData> key,
46
49
Slot<VariantData> value) {
50
+ ARDUINOJSON_ASSERT (data_ != nullptr );
51
+ ARDUINOJSON_ASSERT (resources_ != nullptr );
52
+
47
53
key->setNext (value.id ());
48
54
49
55
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) {
47
47
48
48
template <typename TAdaptedString>
49
49
inline VariantData* ObjectImpl::addMember (TAdaptedString key) {
50
+ if (!data_)
51
+ return nullptr ;
52
+ ARDUINOJSON_ASSERT (resources_ != nullptr );
53
+
50
54
auto keySlot = resources_->allocVariant ();
51
55
if (!keySlot)
52
56
return nullptr ;
@@ -64,6 +68,10 @@ inline VariantData* ObjectImpl::addMember(TAdaptedString key) {
64
68
}
65
69
66
70
inline VariantData* ObjectImpl::addPair (VariantData** value) {
71
+ if (!data_)
72
+ return nullptr ;
73
+ ARDUINOJSON_ASSERT (resources_ != nullptr );
74
+
67
75
auto keySlot = resources_->allocVariant ();
68
76
if (!keySlot)
69
77
return nullptr ;
You can’t perform that action at this time.
0 commit comments