Skip to content
Snippets Groups Projects
Commit 8ab51432 authored by Simon Liu's avatar Simon Liu Committed by dutor
Browse files

Fixed crash when the tag prop not exists. (#934)

parent 17c21c6e
No related branches found
No related tags found
No related merge requests found
......@@ -930,7 +930,7 @@ bool GoExecutor::processFinalResult(RpcResponse &rpcResp, Callback cb) const {
return true;
}
VariantType GoExecutor::VertexHolder::getDefaultProp(TagID tid, const std::string &prop) const {
OptVariantType GoExecutor::VertexHolder::getDefaultProp(TagID tid, const std::string &prop) const {
for (auto it = data_.cbegin(); it != data_.cend(); ++it) {
auto it2 = it->second.find(tid);
if (it2 != it->second.cend()) {
......@@ -939,7 +939,7 @@ VariantType GoExecutor::VertexHolder::getDefaultProp(TagID tid, const std::strin
}
DCHECK(false);
return "";
return Status::Error("Unknown tid");
}
SupportedType GoExecutor::VertexHolder::getDefaultPropType(TagID tid,
......
......@@ -155,7 +155,7 @@ private:
*/
class VertexHolder final {
public:
VariantType getDefaultProp(TagID tid, const std::string &prop) const;
OptVariantType getDefaultProp(TagID tid, const std::string &prop) const;
OptVariantType get(VertexID id, TagID tid, const std::string &prop) const;
void add(const storage::cpp2::QueryResponse &resp);
nebula::cpp2::SupportedType getDefaultPropType(TagID tid, const std::string &prop) const;
......
......@@ -609,5 +609,22 @@ TEST_F(GoTest, ReferenceVariableInYieldAndWhere) {
}
}
TEST_F(GoTest, NotExistTagProp) {
{
cpp2::ExecutionResponse resp;
auto *fmt = "GO FROM %ld OVER serve yield $^.test";
auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid());
auto code = client_->execute(query, resp);
ASSERT_NE(cpp2::ErrorCode::SUCCEEDED, code);
}
{
cpp2::ExecutionResponse resp;
auto *fmt = "GO FROM %ld OVER serve yield serve.test";
auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid());
auto code = client_->execute(query, resp);
ASSERT_NE(cpp2::ErrorCode::SUCCEEDED, code);
}
}
} // namespace graph
} // namespace nebula
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment