1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +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:
Daniel Bertalan 2023-07-26 19:56:09 +02:00 committed by Tim Flynn
parent 9feb1ce39f
commit 66645cdc94
2 changed files with 4 additions and 4 deletions

View file

@ -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;