Skip to content

Commit

Permalink
dMatrix Handle null check and more statments
Browse files Browse the repository at this point in the history
  • Loading branch information
yoquinjo committed Mar 24, 2023
1 parent 2e6df6f commit 2f81ff3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1029,14 +1029,20 @@ XGB_DLL int XGBoosterInplacePredict(BoosterHandle handle,
xgboost::bst_ulong out_dim;
//std::shared_ptr<DMatrix> p_m(dMatrixHandle);
std::shared_ptr<DMatrix> p_m{nullptr};
if (!dMatrixHandle) {
fprintf (stderr, "dMatrixHandle is null");
exit(1);
}
if (!dMatrixHandle) {
p_m.reset(new data::DMatrixProxy);
fprintf (stdout, "dmatrix handle is null");
if (!p_m) {
fprintf (stderr, "p_m 1 is null");
exit(1);
}
} else {
p_m = *static_cast<std::shared_ptr<DMatrix> *>(dMatrixHandle);
fprintf (stdout, "dmatrix handle is not null");
if (!p_m) {
fprintf (stderr, "p_m 2 is null");
exit(1);
Expand Down

0 comments on commit 2f81ff3

Please sign in to comment.