diff --git a/paddle/fluid/ir_adaptor/translator/program_translator.cc b/paddle/fluid/ir_adaptor/translator/program_translator.cc index cc076dd30ba2197c93a8ed310634a60af4cd9899..906555478126517ec9aa8360639fcfd99533be6b 100644 --- a/paddle/fluid/ir_adaptor/translator/program_translator.cc +++ b/paddle/fluid/ir_adaptor/translator/program_translator.cc @@ -145,6 +145,10 @@ void ProgramTranslator::GetParameterForSingleBlock(const BlockDesc& block) { bool need_get_parameter_op = is_parameter && is_unseen_variable; if (need_get_parameter_op) { + PADDLE_ENFORCE_NOT_NULL( + var_desc, + phi::errors::PreconditionNotMet( + "VarDesc of [%s] can not be nullptr", var_name)); ir::Operation* op = InsertGetParamaterOp(ctx_, var_desc); program_->block()->push_back(op); param_map_[var_name] = VariableDefiningInfo(op->result(0));