Skip to content

Commit

Permalink
Guard two uses of get_p() against R_NilValue
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Aug 21, 2024
1 parent e2362a2 commit bfb4a9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inst/include/cpp11/r_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ inline r_vector<T>::r_vector(const r_vector& rhs) {
data_ = safe[Rf_shallow_duplicate](rhs.data_);
protect_ = detail::store::insert(data_);
is_altrep_ = ALTREP(data_);
data_p_ = get_p(is_altrep_, data_);
data_p_ = (data_ == R_NilValue) ? nullptr : get_p(is_altrep_, data_);
length_ = rhs.length_;
capacity_ = rhs.capacity_;
}
Expand Down Expand Up @@ -925,7 +925,7 @@ inline r_vector<T>& r_vector<T>::operator=(const r_vector& rhs) {
data_ = safe[Rf_shallow_duplicate](rhs.data_);
protect_ = detail::store::insert(data_);
is_altrep_ = ALTREP(data_);
data_p_ = get_p(is_altrep_, data_);
data_p_ = (data_ == R_NilValue) ? nullptr : get_p(is_altrep_, data_);
length_ = rhs.length_;
capacity_ = rhs.capacity_;

Expand Down

0 comments on commit bfb4a9b

Please sign in to comment.