Skip to content

Commit 77d83f4

Browse files
committed
Extract addValue NO CHANGE
1 parent 080c8cb commit 77d83f4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ArduinoJson/Variant/VariantData.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ class VariantImpl {
125125

126126
template <typename T>
127127
bool addValue(const T& value) {
128-
auto array = isNull() ? toArray() : asArray();
128+
return addValue(value, data_, resources_);
129+
}
130+
131+
template <typename T>
132+
static bool addValue(const T& value, VariantData* data_,
133+
ResourceManager* resources_) {
134+
if (!data_)
135+
return false;
136+
auto array = data_->type == VariantType::Null ? toArray(data_, resources_)
137+
: asArray(data_, resources_);
129138
return array.addValue(value);
130139
}
131140

0 commit comments

Comments
 (0)