Skip to content

Index out of range #1

@Sosotess93

Description

@Sosotess93

Hi,

I wanted to let you know that you have an error when the 0 number is pressed the app crash.
You get this error.
Fatal error: Index out of range

I can tell you as well where that is coming from.
In you CollectionView (file PasscodeViewController.swift) you didn't protected the index.
See below:
else { numberTapped(Int(keyValues[indexPath.row])!) }

You should do something like :

else {
            if indexPath.row <= 12 {
                if indexPath.row >= keyValues.startIndex && indexPath.row < keyValues.count {
                    numberTapped(Int(keyValues[indexPath.row])!)
                }
            }
        }

I hope that will help you to fix the issue for the next people who are looking for something to protect their apps 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions