Skip to content

Commit

Permalink
fix coredump (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui authored Apr 8, 2024
1 parent 7e3eb8c commit d6c556c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cypher/parser/clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ static lgraph::FieldData MakeFieldData(const Expression &expr) {
}
case Expression::PARAMETER:
break;
case Expression::NULL_:
break;
default:
LOG_WARN() << "[Warning] " << __func__ << ": Error Type";
LOG_WARN() << "Unhandled expression type " << expr.type;
}
return ld;
}
Expand Down
9 changes: 7 additions & 2 deletions src/server/server_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ int main(int argc, char** argv) {
// get config file path, if specified
std::string config_file = "/usr/local/etc/lgraph.json";
std::string cmd = "run";
if (!lgraph::GlobalConfig::PrintVersion(config_file, cmd, &argc, &argv)) {
return 0;
try {
if (!lgraph::GlobalConfig::PrintVersion(config_file, cmd, &argc, &argv)) {
return 0;
}
} catch (std::exception& e) {
LOG_ERROR() << e.what();
return -1;
}
// try to read the config file
std::string json;
Expand Down
8 changes: 8 additions & 0 deletions test/test_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,14 @@ void test_label_field(lgraph::RpcClient& client) {
json_val = web::json::value::parse(str);
UT_EXPECT_EQ(HasElement(json_val, "run", "name"), false);
UT_EXPECT_EQ(HasElement(json_val, "jeep", "name"), false);
ret = client.CallCypher(str,
"CALL db.alterLabelAddFields('vertex', 'animal', "
"['null_string', string, null, true], "
"['null_int8', int8, null, true])");
UT_EXPECT_TRUE(ret);
ret = client.CallCypher(str, "CALL db.alterLabelDelFields('vertex', 'animal', "
"['null_string', 'null_int8'])");
UT_EXPECT_TRUE(ret);
}

void test_procedure(lgraph::RpcClient& client) {
Expand Down

0 comments on commit d6c556c

Please sign in to comment.