Avoid a crash in iOS 13 by jnavarrom · Pull Request #200 · rolandleth/LTHPasscodeViewController · GitHub
Skip to content

Avoid a crash in iOS 13#200

Merged
rolandleth merged 1 commit into
rolandleth:masterfrom
jnavarrom:master
Jun 27, 2019
Merged

Avoid a crash in iOS 13#200
rolandleth merged 1 commit into
rolandleth:masterfrom
jnavarrom:master

Conversation

@jnavarrom

Copy link
Copy Markdown
Contributor

Use firstObject instead [0] when accessing the first element of the windows array.

firstObject returns nil if there is none. Using [0] or objectAtIndex:0 will crash if there is no object there.

We received some crashes in iOS 13 when the application tries to access the first object of the windows array. The code tries to mitigate this crash.

…indows array

firstObject returns nil if there is none. Using [0] or objectAtIndex:0 will crash if there is no object there
@rolandleth

Copy link
Copy Markdown
Owner

@jnavarrom

jnavarrom commented Jun 27, 2019

Copy link
Copy Markdown
Contributor Author

Hi Rolandleth,

It should't break anything, firstObject is available since iOS 4.

I tested it on a devices with iOS 9, 10, 12 and iOS 13.
Unfortunately I don't have devices with iOS 7, 8 and 11.

@rolandleth

Copy link
Copy Markdown
Owner

@rolandleth rolandleth merged commit 5c8efdb into rolandleth:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants