New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash with nil value in valueForPath #41
Conversation
Thanks for the pull request! However, those cases seems to be tested in our test cases, and the tests are passed without the change (the |
So let nested: AnyObject? = object[first]
if let nested = nested {
...
} else {
return nil
} |
@ikesyo In theory, yes. But in fact it crashes. Here is the radar: You'll have crash too for the following object:
Can make a screencast for you. |
Thank you for the pointer to the rader. From what described in that rader, it seems that the crash happens only on device build (iPhone 5c), not on a simulator build, OK? And the actual crash is a
|
It would be great if you correctly offer that informations / assumptions. Those are really important to clarify the problem. |
@ikesyo Sorry for not providing clear instructions. I'm able to reproduce this problem on simulator and any device. The original problem
shows in debugger as I hope that helps |
Thank you for the inputs, and one more question. What version of Xcode (7.0/7.1b1/7.1b2) are you using? I've not tested this library with Xcode 7.1 beta yet. IMHO that should also be in the rader.
If it is reproducable for simulators, the test suite should crash. Please run the tests on your environment. |
Run |
Missing keys should be covered with |
I can see your test passing, but in my project it is still crashing. Can't figure out, where the problem is |
@Nikita2k I did the steps of your rader with today's Xcode 7.0.1, and I can't reproduce the problem for both device and simulator. To reinstall Xcode might be help... |
If you have
object[first] = nil
it will crash (fatal error: unexpectedly found nil while unwrapping an Optional value), as of left we have non-optional type. You should change AnyObject to optional or remove it (but it will raise warning)