Skip to content
Verified Commit fc95fed5 authored by snooxx 💤's avatar snooxx 💤
Browse files

KFilePlacesView: Fix potential crash in `previousVisibleIndex`

The previous commit fixed a crash in
`KFilePlacesViewDelegate::previousVisibleIndex`, where access to `model`
failed due to an invalid index.

In addition to the previous commit already fixing the crash, unrelated
potential crashes in the future can be avoided by checking for an
invalid `index` in `previousVisibleIndex`. The existing logic of
`indexIsSectionHeader` is kept intact, since now an invalid `index` will
lead to comparing two empty strings, i.e. it will not be considered a
section header as required by the rest of the code.

This fix alone would already solve the crash without any side effects,
still introducing `m_dropIndex` seemed less brittle.

CCBUG: 450813
CCBUG: 450966

Test Plan:

Functionality related to dragging places around (including existing
bugs) is unaffected.
parent 38662957
Loading
Loading
Loading
Pipeline #145214 passed with stage
in 8 minutes and 3 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment