Skip to content

Commit

Permalink
Merge pull request #740 from gadomski/translate-crop-null-stage-ptr
Browse files Browse the repository at this point in the history
Fix NULL pointer in `pdal translate --polygon`
  • Loading branch information
hobu committed Feb 1, 2015
2 parents f02dea5 + 96e660a commit e8df5e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kernels/translate/TranslateKernel.cpp
Expand Up @@ -191,14 +191,15 @@ std::unique_ptr<Stage> TranslateKernel::makeReader(Options readerOptions)

Stage* TranslateKernel::makeTranslate(Options translateOptions, Stage* reader_stage)
{
StageFactory f;
Stage* final_stage = reader_stage;
Options readerOptions = reader_stage->getOptions();
std::map<std::string, Options> extra_opts = getExtraStageOptions();
if (!m_bounds.empty() || !m_wkt.empty() || !m_output_srs.empty() || extra_opts.size() > 0)
{
Stage* next_stage = reader_stage;
Stage* crop_stage(0);
Stage* reprojection_stage(0);
Stage* crop_stage = f.createFilter("filters.crop");
Stage* reprojection_stage = f.createFilter("filters.reprojection");


bool bHaveReprojection = extra_opts.find("filters.reprojection") != extra_opts.end();
Expand Down Expand Up @@ -261,7 +262,6 @@ Stage* TranslateKernel::makeTranslate(Options translateOptions, Stage* reader_st

if (boost::iequals(m_decimation_method, "VoxelGrid"))
{
StageFactory f;
Stage* decimation_stage(f.createFilter("filters.pclblock"));

Options decimationOptions;
Expand Down Expand Up @@ -294,7 +294,6 @@ Stage* TranslateKernel::makeTranslate(Options translateOptions, Stage* reader_st
decimationOptions.add("step", m_decimation_step);
decimationOptions.add("offset", m_decimation_offset);
decimationOptions.add("limit", m_decimation_limit);
StageFactory f;
Stage* decimation_stage(f.createFilter("filters.decimation"));
decimation_stage->setInput(final_stage);
decimation_stage->setOptions(decimationOptions);
Expand Down

0 comments on commit e8df5e6

Please sign in to comment.