We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
JSONItem::GetAsMap()
1 parent 40bf0c1 commit 3e0150eCopy full SHA for 3e0150e
CodeLite/JSON.cpp
@@ -182,7 +182,7 @@ JSONItem JSONItem::operator[](int index) const
182
183
std::unordered_map<std::string_view, JSONItem> JSONItem::GetAsMap() const
184
{
185
- if (!m_json) {
+ if (!m_json || !isObject()) {
186
return {};
187
}
188
Tests/CodeliteTest/JsonTests.cpp
@@ -217,9 +217,7 @@ TEST_CASE("array json")
217
CHECK(!item.hasNamedObject("a"));
218
CHECK(!item.namedObject("a").isOk());
219
CHECK(!item["a"].isOk());
220
-#if 0 // crash
221
CHECK(item.GetAsMap().empty());
222
-#endif
223
224
225
TEST_CASE("object json")
0 commit comments