Unverified Commit fee6f4a2 authored by shiyu1994's avatar shiyu1994 Committed by GitHub
Browse files

avoid segment fault in ResetConfig for GBDT in prediction (fix #3317) (#3373)

parent f7f4e602
...@@ -20,6 +20,7 @@ namespace LightGBM { ...@@ -20,6 +20,7 @@ namespace LightGBM {
GBDT::GBDT() GBDT::GBDT()
: iter_(0), : iter_(0),
train_data_(nullptr), train_data_(nullptr),
config_(nullptr),
objective_function_(nullptr), objective_function_(nullptr),
early_stopping_round_(0), early_stopping_round_(0),
es_first_metric_only_(false), es_first_metric_only_(false),
...@@ -718,7 +719,7 @@ void GBDT::ResetConfig(const Config* config) { ...@@ -718,7 +719,7 @@ void GBDT::ResetConfig(const Config* config) {
if (train_data_ != nullptr) { if (train_data_ != nullptr) {
ResetBaggingConfig(new_config.get(), false); ResetBaggingConfig(new_config.get(), false);
} }
if (config_->forcedsplits_filename != new_config->forcedbins_filename) { if (config_.get() != nullptr && config_->forcedsplits_filename != new_config->forcedbins_filename) {
// load forced_splits file // load forced_splits file
if (!new_config->forcedsplits_filename.empty()) { if (!new_config->forcedsplits_filename.empty()) {
std::ifstream forced_splits_file( std::ifstream forced_splits_file(
......
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