infinitered / infinitered/bluepotion
Crash if rotating device while an alert dialog is open
- Dominant language
- Ruby
- Stars
- 74
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
If you fire up an alert dialog and rotate the phone you'll get this:
```
Exception raised: NoMethodError: undefined method `[]' for nil:NilClass
from alert_dialog.rb:47 in `onCreateDialog'
```
so [it looks like](https://github.com/infinitered/bluepotion/blob/master/lib/project/alert_dialog/alert_dialog.rb#L47) `onCreateDialog` is getting called again after the rotation, but `@options` is gone? Not sure how that's possible. If it's calling the method on the instance shouldn't the instance variable still be around?
Ah but it's a new instance . . . interesting. When I put a `mp self.inspect` in the `onCreateDialog` method then I find that before rotation I get this:
```
#
```
and after I rotate, just before the crash, I get this
```
#
```
I'll be looking around and seeing if this is something I can fix. In the meantime, if someone else has seen this kind of thing before (new class instances on rotation) and knows the right path forward, please let me know! :)
Contributor guide
Research direction
Start with lib/project/alert_dialog/alert_dialog.rb at line 47 and reproduce the crash by opening an alert dialog and rotating the phone. Trace onCreateDialog across the recreated instance and determine how the missing @options state is handled. Done means rotation no longer raises the reported NoMethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, ruby
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100