Fix #3712 double check if activity is alive

This commit is contained in:
Victor Shcherb 2017-05-28 14:32:45 +02:00
parent f454b12d07
commit d6a53c43c2

View file

@ -497,6 +497,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
@Override @Override
protected void onPostExecute(Void res) { protected void onPostExecute(Void res) {
hideProgressBar(); hideProgressBar();
if(getActivity() == null) {
// user quit application
return;
}
try { try {
if (src != null && dst != null) { if (src != null && dst != null) {
Algorithms.fileCopy(src, dst); Algorithms.fileCopy(src, dst);
@ -518,7 +522,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
startActivity(sendIntent); startActivity(sendIntent);
} catch (IOException e) { } catch (IOException e) {
//Toast.makeText(getActivity(), "Error sharing favorites: " + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), "Error sharing favorites: " + e.getMessage(), Toast.LENGTH_SHORT).show();
e.printStackTrace(); e.printStackTrace();
} }
} }