When logging errors with deleteView, try to find actual index of view
Summary: If we try to delete a view and find the wrong one, when we crash, try to log the *actual* index of the view in question. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D23368229 fbshipit-source-id: 7f9835fd07cfe4924d05c7e37b42b9bcdffff4a9
This commit is contained in:
Родитель
cb48b50290
Коммит
d344fb4e29
|
@ -366,7 +366,16 @@ public class MountingManager {
|
|||
|
||||
// Verify that the view we're about to remove has the same tag we expect
|
||||
View view = viewGroupManager.getChildAt(parentView, index);
|
||||
if (view != null && view.getId() != tag) {
|
||||
int actualTag = (view != null ? view.getId() : -1);
|
||||
if (actualTag != tag) {
|
||||
int tagActualIndex = -1;
|
||||
for (int i = 0; i < parentView.getChildCount(); i++) {
|
||||
if (parentView.getChildAt(i).getId() == tag) {
|
||||
tagActualIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
"Tried to delete view ["
|
||||
+ tag
|
||||
|
@ -375,7 +384,9 @@ public class MountingManager {
|
|||
+ "] at index "
|
||||
+ index
|
||||
+ ", but got view tag "
|
||||
+ view.getId());
|
||||
+ actualTag
|
||||
+ " - actual index of view: "
|
||||
+ tagActualIndex);
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Загрузка…
Ссылка в новой задаче