Open Bug 2089959 Opened 18 days ago

Remove the dead null check in nsFrameIterator::Last

Categories

(Core :: Layout, task)

task

Tracking

()

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

In nsFrameIterator::Last(), the only caller builds the iterator from a non-null frame and the loop only assigns non-null results, so the if (!parent) { SetOffEdge(1); } check is dead. Remove it (or replace it with MOZ_ASSERT(parent)). Note: SetOffEdge(1) appears twice in the file; this is the one in Last().

Current code:

  if (!parent) {
    SetOffEdge(1);
  }

Link to the code:
https://searchfox.org/firefox-main/source/layout/base/nsFrameTraversal.cpp

To verify the fix:

./mach build
./mach test layout/base/tests --headless

This was reported by Coverity Scan (CID 1559932). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

You need to log in before you can comment on or make changes to this bug.