Skip to content
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

[BUG] Weird decklist causing a crash in the app #125

Closed
phated opened this issue Mar 18, 2020 · 5 comments
Closed

[BUG] Weird decklist causing a crash in the app #125

phated opened this issue Mar 18, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@phated
Copy link

phated commented Mar 18, 2020

Describe the bug
I play a "commander"-style format for Pokemon and DeckBox has been great to plan our decks until I recently updated. When I try to load a "weird" decklist, it crashes. I tried digging into the stack trace, but I don't understand Android/Java enough to understand it. I'll put the decklist in the reproduction section.

To Reproduce
Steps to reproduce the behavior:

  1. Import this decklist into DeckBox:
****** Turbo Vileplume ******

##Pokémon - 34

* 1 Rowlet & Alolan Exeggutor-GX UNM 215
* 1 Oddish JU 58
* 1 Oddish HL 68
* 1 Oddish EX 122
* 1 Oddish UNB 5
* 1 Oddish UNB 6
* 1 Oddish BCR 1
* 1 Oddish BUS 4
* 1 Oddish LA 111
* 1 Oddish N1 68
* 1 Oddish UD 60
* 1 Oddish UF 64
* 1 Oddish TR 63
* 1 Oddish CEC 2
* 1 Oddish AOR 1
* 1 Oddish AQ 97
* 1 Gloom UNB 7
* 1 Gloom UD 27
* 1 Gloom BCR 2
* 1 Gloom BUS 5
* 1 Gloom LA 96
* 1 Gloom UF 58
* 1 Gloom N1 36
* 1 Gloom EX 78
* 1 Gloom JU 37
* 1 Gloom HL 35
* 1 Gloom AOR 2
* 1 Dark Gloom TR 36
* 1 Gloom CEC 3
* 1 Gloom AQ 49
* 1 Vileplume UD 24
* 1 Dark Vileplume TR 30
* 1 Vileplume BUS 6
* 1 Vileplume AOR 3

##Trainer Cards - 38

* 1 Bill B2 118
* 1 Gust of Wind B2 120
* 1 Acerola BUS 112
* 1 Twins TM 89
* 1 Item Finder B2 103
* 1 VS Seeker PHF 109
* 1 Computer Search B2 101
* 1 Pokémon Collector HS 97
* 1 Guzma BUS 115
* 1 Town Map BCR 136
* 1 Ultra Ball SLG 68
* 1 Junk Arm TM 87
* 1 Pokémon Catcher EPO 95
* 1 Luxury Ball SF 86
* 1 Professor Oak BS 88
* 1 Focus Band N1 86
* 1 Gladion CIN 95
* 1 N NVI 92
* 1 Great Ball SF 85
* 1 Professor Sycamore PHF 101
* 1 Level Ball AOR 76
* 1 Field Blower GRI 125
* 1 Teammates PRC 141
* 1 Skyla BCR 134
* 1 Startling Megaphone FLF 97
* 1 Colress PLS 118
* 1 Muscle Band XY 121
* 1 Lusamine CIN 96
* 1 Counter Catcher CIN 91
* 1 Windstorm CG 85
* 1 Karen PR-XY XY177
* 1 Choice Band GRI 121
* 1 Lysandre AOR 78
* 1 Nest Ball SUM 123
* 1 Professor's Letter XY 123
* 1 Dowsing Machine PLS 128
* 1 Professor Juniper BLW 101
* 1 Lysandre's Trump Card PHF 99

##Energy - 0


Total Cards - 72

****** Deck List Generated by DeckBox ******
  1. Try opening the deck.
  2. The app crashes.

Expected behavior
The deck should load.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: Moto X4 but I'm guessing it's happening on @mmxxiii's device too. It doesn't seem like a device problem.
  • OS: Android 9
  • Version 1.11.0.3550-release/v1.11.0+4

Additional context
This app is great! And I'm happy to help out however I can. Keep up the awesome work.

@phated phated added the bug Something isn't working label Mar 18, 2020
@mmxxiii
Copy link

mmxxiii commented Mar 18, 2020

Confirmed. It happens on my Samsung Galaxy S8 as well. Imports fine, but crashes when I try to open the decklist.

@r0adkll
Copy link
Owner

r0adkll commented Mar 18, 2020

Thanks for the detailed report! I'll take a look into this and see what's going wrong

@mmxxiii
Copy link

mmxxiii commented Jun 22, 2022

Simplified import which crashes the app:

****** DeckBox Crash List ******

##Pokémon - 5

* 1 Oddish JU 58
* 1 Oddish HL 68
* 1 Oddish EX 122
* 1 Oddish UNB 5
* 1 Oddish UNB 6
* 1 Gloom UNB 7

##Trainer Cards - 0

##Energy - 0


Total Cards - 5

****** Deck List Generated by DeckBox ******

Anytime there are more that 5 different cards of the previous evolution of a pokemon, it crashes with the same error.

@phated
Copy link
Author

phated commented Jun 22, 2022

The issue seems to be the use of parent.getChildAt with a RecyclerView, which returns null if the item is outside of a "row"

I found this on stack overflow:

When there is more than one page of data in your recycler view and you're using getChildAt() method, it will throw a null pointer exception. This is because when the position is greater than the number of visible items on the display, getChildAt() won't work as it can only get to the view that is displayed on the screen.

Therefore, use recyclerView.layoutManager?.findViewByPosition(position) to get the view at the given position.

@phated
Copy link
Author

phated commented Jul 9, 2022

Fixed by #141

@phated phated closed this as completed Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants