diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp @@ -310,8 +310,13 @@ for (auto idx = 0; idx < operations.size(rt); idx++) { auto op = operations.getValueAtIndex(rt, idx).asObject(rt); auto op_type = op.getProperty(rt, "type").asString(rt).utf8(rt); - auto payload_obj = op.getProperty(rt, "payload").asObject(rt); + if (op_type == REMOVE_ALL_OPERATION) { + messageStoreOps.push_back(std::make_unique()); + continue; + } + + auto payload_obj = op.getProperty(rt, "payload").asObject(rt); if (op_type == REMOVE_OPERATION) { messageStoreOps.push_back( std::make_unique(rt, payload_obj)); @@ -328,9 +333,6 @@ messageStoreOps.push_back( std::make_unique(rt, payload_obj)); - } else if (op_type == REMOVE_ALL_OPERATION) { - messageStoreOps.push_back(std::make_unique()); - } else { throw std::runtime_error("unsupported operation: " + op_type); }