diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java index 1f052e1..cc27fac 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java @@ -116,14 +116,16 @@ public class HomeFragment extends Fragment { initialized = true; lg.trace("Saved instance state {}", savedInstanceState); - if (savedInstanceState == null) { - lg.trace("Saved instance state is null"); - photos = new ArrayList<>(); - } - else { - final Serializable serializable = savedInstanceState.getSerializable(PHOTO_LIST); - lg.trace("Photo list serializable {}", serializable); - photos = (ArrayList) serializable; + if (photos == null) { + if (savedInstanceState == null) { + lg.trace("Saved instance state is null"); + photos = new ArrayList<>(); + } + else { + final Serializable serializable = savedInstanceState.getSerializable(PHOTO_LIST); + lg.trace("Photo list serializable {}", serializable); + photos = (ArrayList) serializable; + } } locations.setAdapter(new PanoramioAdapter(getActivity(), R.layout.location_item, photos));