-
Notifications
You must be signed in to change notification settings - Fork 147
Open
Description
Versions: 0.9.34-0.9.37
Device: any
Steps to reproduce
- Add view to layout without
idor inflate it programmaticaly - Set view
idto any value or generate value usingView.generateViewId() - Launch the app
- In attribute inspector mode click on that view. Probably some scroll is needed in attributes dialog list until the row representing view id is visible.
Actual: crash
Expected: no crash. View id value shows empty string.
Stacktrace:
App defined error. android.content.res.Resources$NotFoundException: Unable to find resource ID #0x14
Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x14
at android.content.res.ResourcesImpl.getResourceEntryName(ResourcesImpl.java:289)
at android.content.res.Resources.getResourceEntryName(Resources.java:2335)
at com.willowtreeapps.hyperion.attr.collectors.ResourceValue.getDisplayValue(ResourceValue.java:21)
at com.willowtreeapps.hyperion.attr.ViewAttribute.getDisplayValue(ViewAttribute.java:42)
at com.willowtreeapps.hyperion.attr.AttributeDetailView$AttributeViewHolder.onDataChanged(AttributeDetailView.java:164)
at com.willowtreeapps.hyperion.attr.AttributeDetailView$AttributeViewHolder.onDataChanged(AttributeDetailView.java:147)
at com.willowtreeapps.hyperion.attr.DataViewHolder.bind(DataViewHolder.java:20)
at com.willowtreeapps.hyperion.attr.AttributeDetailView$AttributeAdapter.onBindViewHolder(AttributeDetailView.java:118)
at com.willowtreeapps.hyperion.attr.AttributeDetailView$AttributeAdapter.onBindViewHolder(AttributeDetailView.java:83)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
The reason of the crash is that view id is always handled as a resource value and resources.getResourceEntryName(id) is called in ResourceValue class after single check id > 0. Ad-hoc solution is to wrap resources.getResourceEntryName(id) with try-catch and return empty string in case of exception.
Metadata
Metadata
Assignees
Labels
No labels