@@ -50,7 +50,7 @@ class OldMeterIdentificationAttributes
50
50
if (!value.IsNull ())
51
51
{
52
52
const size_t len = value.Value ().size ();
53
- if (auto * str = static_cast <char *>(chip::Platform::MemoryAlloc (1 + len)))
53
+ if (auto * str = static_cast <char *>(chip::Platform::MemoryAlloc (len)))
54
54
{
55
55
memcpy (str, value.Value ().data (), len);
56
56
str[len] = 0 ;
@@ -159,8 +159,9 @@ class OldMeterIdentificationAttributes
159
159
}
160
160
else
161
161
{
162
+ const auto value = mInstance ->GetPointOfDelivery ().Value ();
162
163
mInstance ->SetPointOfDelivery (DataModel::MakeNullable (CharSpan::fromCharString (IncrementString (
163
- mInstance -> GetPointOfDelivery (). Value (). data ( )).c_str ())));
164
+ std::string (value. data (), value. size () )).c_str ())));
164
165
}
165
166
166
167
if (mInstance ->GetMeterSerialNumber ().IsNull ())
@@ -169,8 +170,9 @@ class OldMeterIdentificationAttributes
169
170
}
170
171
else
171
172
{
173
+ const auto value = mInstance ->GetMeterSerialNumber ().Value ();
172
174
mInstance ->SetMeterSerialNumber (DataModel::MakeNullable (CharSpan::fromCharString (IncrementString (
173
- mInstance -> GetMeterSerialNumber (). Value (). data ( )).c_str ())));
175
+ std::string (value. data (), value. size () )).c_str ())));
174
176
}
175
177
176
178
if (mInstance ->GetProtocolVersion ().IsNull ())
@@ -179,8 +181,9 @@ class OldMeterIdentificationAttributes
179
181
}
180
182
else
181
183
{
184
+ const auto value = mInstance ->GetProtocolVersion ().Value ();
182
185
mInstance ->SetProtocolVersion (DataModel::MakeNullable (CharSpan::fromCharString (IncrementString (
183
- mInstance -> GetProtocolVersion (). Value (). data ( )).c_str ())));
186
+ std::string (value. data (), value. size () )).c_str ())));
184
187
}
185
188
186
189
if (mInstance ->GetPowerThreshold ().IsNull ())
0 commit comments