fix another likely race condition

Use an ArrayList rather than an array, though that the size of the array
changed mid-calc suggests there could be other problems later. We'll see.
This commit is contained in:
Eric House 2020-04-29 10:44:31 -07:00
parent 8fb21002ad
commit 0e0615f5d2

View file

@ -251,16 +251,17 @@ abstract class InviteDelegate extends DelegateBase
private InviterItem[] getSelItems()
{
InviterItem[] result = new InviterItem[m_checked.size()];
List<InviterItem> list = new ArrayList<>();
int next = 0;
for ( int ii = 0; ii < m_lv.getChildCount(); ++ii ) {
InviterItemFrame child = (InviterItemFrame)m_lv.getChildAt( ii );
InviterItem item = child.getItem();
if ( m_checked.contains( item.getDev() ) ) {
result[next++] = item;
list.add( item );
Assert.assertTrue( child.isChecked() || !BuildConfig.DEBUG );
}
}
InviterItem[] result = list.toArray( new InviterItem[list.size()] );
return result;
}