Fixed member-call-on-null-pointer in getMember() when array is empty

This commit is contained in:
Benoit Blanchon
2021-04-15 11:30:56 +02:00
parent 88fbe3ac34
commit 898f429826
2 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@ HEAD
* Changed `JsonVariantConst::is<JsonArray/JsonObject>()` to return `false` (issue #1412)
* Simplified `JsonVariant::as<T>()` to always return `T` (see below)
* Updated folders list in `.mbedignore` (PR #1515 by @AGlass0fMilk)
* Fixed member-call-on-null-pointer in `getMember()` when array is empty
> ### BREAKING CHANGES
>

View File

@ -115,6 +115,8 @@ inline VariantSlot* CollectionData::getSlot(TAdaptedString key) const {
}
inline VariantSlot* CollectionData::getSlot(size_t index) const {
if (!_head)
return 0;
return _head->next(index);
}