Skip to content

Commit

Permalink
Issue #1126 graphd crashed (#1128)
Browse files Browse the repository at this point in the history
Fixed an issue that encountered an unimplemented grammar that could cause a crash.
  • Loading branch information
monadbobo authored and dangleptr committed Oct 22, 2019
1 parent 27663d6 commit c18a3a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/graph/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ std::unique_ptr<Executor> Executor::makeExecutor(Sentence *sentence) {
executor = std::make_unique<LimitExecutor>(sentence, ectx());
break;
case Sentence::Kind::kUnknown:
LOG(FATAL) << "Sentence kind unknown";
break;
LOG(ERROR) << "Sentence kind unknown";
return nullptr;
default:
LOG(FATAL) << "Sentence kind illegal: " << kind;
break;
LOG(ERROR) << "Sentence kind illegal: " << kind;
return nullptr;
}
return executor;
}
Expand Down
4 changes: 3 additions & 1 deletion src/graph/SequentialExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Status SequentialExecutor::prepare() {
for (auto i = 0U; i < sentences_->sentences_.size(); i++) {
auto *sentence = sentences_->sentences_[i].get();
auto executor = makeExecutor(sentence);
DCHECK(executor != nullptr);
if (executor == nullptr) {
return Status::Error("The statement has not been implemented");
}
auto status = executor->prepare();
if (!status.ok()) {
FLOG_ERROR("Prepare executor `%s' failed: %s",
Expand Down

0 comments on commit c18a3a3

Please sign in to comment.