Skip to content

Commit

Permalink
fix early deletion of wasm state schema (envoyproxy#227)
Browse files Browse the repository at this point in the history
Signed-off-by: Kuat Yessenov <[email protected]>
  • Loading branch information
kyessenov authored Jun 22, 2020
1 parent 71de2b0 commit afc9467
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/extensions/common/wasm/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,12 @@ WasmResult Context::setProperty(absl::string_view path, absl::string_view value)

WasmResult Context::declareProperty(absl::string_view path,
std::unique_ptr<const WasmStatePrototype> state_prototype) {
state_prototypes_[path] = std::move(state_prototype);
return WasmResult::Ok;
// Do not delete existing schema since it can be referenced by state objects.
if (state_prototypes_.find(path) == state_prototypes_.end()) {
state_prototypes_[path] = std::move(state_prototype);
return WasmResult::Ok;
}
return WasmResult::BadArgument;
}

void Context::scriptLog(spdlog::level::level_enum level, absl::string_view message) {
Expand Down

0 comments on commit afc9467

Please sign in to comment.