Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08a24ffb authored by Martin Brabham's avatar Martin Brabham Committed by Gerrit Code Review
Browse files

Prevent possible OutOfBoundsException

Change-Id: I8fc90a2ade069764732c35b71c5ae450d5d3cc5a
parent 3a81139f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -164,6 +164,12 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
            try {
                // Response if the item can be removed
                FileSystemObjectAdapter adapter = (FileSystemObjectAdapter)parent.getAdapter();

                // Short circuit to protect OOBE
                if (position < 0 || position >= adapter.getCount()) {
                    return false;
                }

                FileSystemObject fso = adapter.getItem(position);
                if (fso != null) {
                    if (fso instanceof ParentDirectory) {