Fixed crash when adding tunnel to empty list

This commit is contained in:
str4d
2016-06-13 09:57:58 +00:00
parent ecb08a54fb
commit 6d4fe52f8e
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
0.9.26
* Fixed "I2CP already listening" bug
* Fixed crash when adding tunnel to empty list
0.9.25 / 2016-04-17 / 46d45a878a2b73394b26ca27dbe6c696dedcf1c3
* Fixed a bug on Samsung Android 4.2 devices

View File

@ -65,8 +65,13 @@ public class TunnelEntryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
public void addTunnel(TunnelEntry tunnel) {
boolean wasEmpty = mTunnels.isEmpty();
mTunnels.add(tunnel);
notifyItemInserted(mTunnels.size()-1);
if (wasEmpty) {
notifyDataSetChanged();
} else {
notifyItemInserted(mTunnels.size() - 1);
}
}
public TunnelEntry getTunnel(int position) {