diff --git a/mindspore/core/abstract/abstract_value.h b/mindspore/core/abstract/abstract_value.h index f9bf8f84ba7bdf4fea21383668adf993534ff7a9..b66e5a9c3f96145e4dd3021f1cf81f4b3d132a67 100644 --- a/mindspore/core/abstract/abstract_value.h +++ b/mindspore/core/abstract/abstract_value.h @@ -563,7 +563,9 @@ class AbstractRefKey : public AbstractBase { } inline void set_value(const ValuePtr &value) { AbstractBase::set_value(value); - ref_key_value_ = value->cast(); + if (value != nullptr) { + ref_key_value_ = value->cast(); + } } RefKeyPtr ref_key_value() const { return ref_key_value_; } AbstractBasePtr Join(const AbstractBasePtr &other) override;