Skip to content

Commit

Permalink
added null check for fetchers in DataManager
Browse files Browse the repository at this point in the history
  • Loading branch information
lambday committed Aug 11, 2016
1 parent 6b6036b commit dcac98e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/shogun/statistical_testing/internals/DataManager.cpp
Expand Up @@ -165,7 +165,10 @@ CFeatures* DataManager::samples_at(size_t i) const
"Value of i (%d) should be between 0 and %d, inclusive!",
i, fetchers.size()-1);
SG_SDEBUG("Leaving!\n");
return fetchers[i]->m_samples;
if (fetchers[i]!=nullptr)
return fetchers[i]->m_samples;
else
return nullptr;
}

index_t& DataManager::num_samples_at(size_t i)
Expand All @@ -185,7 +188,10 @@ const index_t DataManager::num_samples_at(size_t i) const
"Value of i (%d) should be between 0 and %d, inclusive!",
i, fetchers.size()-1);
SG_SDEBUG("Leaving!\n");
return fetchers[i]->get_num_samples();
if (fetchers[i]!=nullptr)
return fetchers[i]->get_num_samples();
else
return 0;
}

const index_t DataManager::blocksize_at(size_t i) const
Expand All @@ -195,7 +201,10 @@ const index_t DataManager::blocksize_at(size_t i) const
"Value of i (%d) should be between 0 and %d, inclusive!",
i, fetchers.size()-1);
SG_SDEBUG("Leaving!\n");
return fetchers[i]->m_block_details.m_blocksize;
if (fetchers[i]!=nullptr)
return fetchers[i]->m_block_details.m_blocksize;
else
return 0;
}

void DataManager::set_blockwise(bool blockwise)
Expand Down

0 comments on commit dcac98e

Please sign in to comment.