allow nullptr when not care the removed array value
diff --git a/include/json/value.h b/include/json/value.h
index 8a0054c..e7a9225 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -562,7 +562,7 @@
/** \brief Remove the indexed array element.
O(n) expensive operations.
- Update 'removed' if removed.
+ Update 'removed' iff removed.
\return true if removed (no exceptions)
*/
bool removeIndex(ArrayIndex index, Value* removed);
diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp
index 01e9548..c77d1df 100644
--- a/src/lib_json/json_value.cpp
+++ b/src/lib_json/json_value.cpp
@@ -1243,7 +1243,8 @@
if (it == value_.map_->end()) {
return false;
}
- *removed = it->second;
+ if (removed)
+ *removed = it->second;
ArrayIndex oldSize = size();
// shift left all items left, into the place of the "removed"
for (ArrayIndex i = index; i < (oldSize - 1); ++i) {