mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS+LibWeb: Mark NonnullGCPtr::ptr()
as returns_nonnull
This invariant is enforced by the fact that `NonnullGCPtr` can only be constructed from references. This commit fixes an instance where we compared a pointer to null after we have already dereferenced it.
This commit is contained in:
parent
9feb1ce39f
commit
66645cdc94
Notes:
sideshowbarker
2024-07-16 22:51:10 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/66645cdc94 Pull-request: https://github.com/SerenityOS/serenity/pull/20406
2 changed files with 4 additions and 4 deletions
|
@ -60,13 +60,13 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
T* operator->() const { return m_ptr; }
|
||||
RETURNS_NONNULL T* operator->() const { return m_ptr; }
|
||||
|
||||
T& operator*() const { return *m_ptr; }
|
||||
|
||||
T* ptr() const { return m_ptr; }
|
||||
RETURNS_NONNULL T* ptr() const { return m_ptr; }
|
||||
|
||||
operator T*() const { return m_ptr; }
|
||||
RETURNS_NONNULL operator T*() const { return m_ptr; }
|
||||
|
||||
operator T&() const { return *m_ptr; }
|
||||
|
||||
|
|
|
@ -682,7 +682,7 @@ constexpr bool should_ignore_keydown_event(u32 code_point)
|
|||
|
||||
bool EventHandler::fire_keyboard_event(FlyString const& event_name, HTML::BrowsingContext& browsing_context, KeyCode key, unsigned int modifiers, u32 code_point)
|
||||
{
|
||||
JS::NonnullGCPtr<DOM::Document> document = *browsing_context.active_document();
|
||||
JS::GCPtr<DOM::Document> document = browsing_context.active_document();
|
||||
if (!document)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue