"...tests/git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "170a93044bf7c8c3d90d64b4ceeb21d3c8bf1fbb"
Unverified Commit fa9e4527 authored by shiyu1994's avatar shiyu1994 Committed by GitHub
Browse files

[c++][fix] check nullable of bin mappers in dataset_loader.cpp (fix #5221) (#5258)

check nullable of bin mappers
parent 4971a066
...@@ -1472,7 +1472,7 @@ void DatasetLoader::CheckCategoricalFeatureNumBin( ...@@ -1472,7 +1472,7 @@ void DatasetLoader::CheckCategoricalFeatureNumBin(
if (bin_mappers.size() < 1024) { if (bin_mappers.size() < 1024) {
for (size_t i = 0; i < bin_mappers.size(); ++i) { for (size_t i = 0; i < bin_mappers.size(); ++i) {
const int max_bin_for_this_feature = max_bin_by_feature.empty() ? max_bin : max_bin_by_feature[i]; const int max_bin_for_this_feature = max_bin_by_feature.empty() ? max_bin : max_bin_by_feature[i];
if (bin_mappers[i]->bin_type() == BinType::CategoricalBin && bin_mappers[i]->num_bin() > max_bin_for_this_feature) { if (bin_mappers[i] != nullptr && bin_mappers[i]->bin_type() == BinType::CategoricalBin && bin_mappers[i]->num_bin() > max_bin_for_this_feature) {
need_warning = true; need_warning = true;
break; break;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment