Identiconizer
Identiconizer copied to clipboard
App crashes when create contact Identicons is clicked, after changing text length value.
Expected behavior
I expected not to crash while trying to create contact Identicons, after changing the value of text length.
Actual behavior
The app crashes after changing text leng I, and trying to create contact Identicons.
It crashes when the text length is changed to higher values like 5 and 4. It doesn't crash sometimes with 2, and 3. It doesn't crash at all with 1.
How to reproduce
- launch the Identiconizer
- Click, and change text length ( set it to 5 )
- click create Identicons
- watch it crash
Screenshot/Gif

Devices
Device: Tecno Camon Xpro OS: Android Version 8.1
04-09 18:32:13.575 31942-31950/? E/zygote64: Failed sending reply to debugger: Broken pipe
04-09 18:34:04.562 31942-32127/com.germainz.identiconizer E/AndroidRuntime: FATAL EXCEPTION: IntentService[IdenticonCreationService]
Process: com.germainz.identiconizer, PID: 31942
java.lang.IndexOutOfBoundsException
at android.graphics.Paint.getTextBounds(Paint.java:2642)
at com.germainz.identiconizer.identicons.LetterTile.generateIdenticonBitmap(LetterTile.java:90)
at com.germainz.identiconizer.identicons.LetterTile.generateIdenticonByteArray(LetterTile.java:97)
at com.germainz.identiconizer.services.IdenticonCreationService.generateIdenticon(IdenticonCreationService.java:147)
at com.germainz.identiconizer.services.IdenticonCreationService.processContacts(IdenticonCreationService.java:93)
at com.germainz.identiconizer.services.IdenticonCreationService.onHandleIntent(IdenticonCreationService.java:75)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)