Skip to content

Commit

Permalink
Fix Segment fault when creates TitanCompactionFilter (#181)
Browse files Browse the repository at this point in the history
Looks like it's not a undefined behavior to get a nullptr from compaction filter factory

Fixes #180 

Signed-off-by: DorianZheng <xingzhengde72@gmail.com>
  • Loading branch information
DorianZheng authored Jul 17, 2020
1 parent 6abf3dc commit 9df8f05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/compaction_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ class TitanCompactionFilterFactory final : public CompactionFilterFactory {
original_filter_factory_->CreateCompactionFilter(context);
original_filter = original_filter_from_factory.get();
}

if (original_filter == nullptr) {
return nullptr;
}

return std::unique_ptr<CompactionFilter>(new TitanCompactionFilter(
titan_db_impl_, cf_name_, original_filter,
std::move(original_filter_from_factory), blob_storage, skip_value_));
Expand Down

0 comments on commit 9df8f05

Please sign in to comment.