зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1677409 - MOZ_ASSERT(not null) in UniquePtr::operator* - r=sg
Dereferencing a null pointer is UB, so it's good to catch such misuses early. Differential Revision: https://phabricator.services.mozilla.com/D97104
This commit is contained in:
Родитель
927d2292fd
Коммит
831c1bd198
|
@ -276,9 +276,12 @@ class UniquePtr {
|
|||
return *this;
|
||||
}
|
||||
|
||||
std::add_lvalue_reference_t<T> operator*() const { return *get(); }
|
||||
std::add_lvalue_reference_t<T> operator*() const {
|
||||
MOZ_ASSERT(get(), "dereferencing a UniquePtr containing nullptr with *");
|
||||
return *get();
|
||||
}
|
||||
Pointer operator->() const {
|
||||
MOZ_ASSERT(get(), "dereferencing a UniquePtr containing nullptr");
|
||||
MOZ_ASSERT(get(), "dereferencing a UniquePtr containing nullptr with ->");
|
||||
return get();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче