Fix #3712 double check if activity is alive

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

View file

@ -497,6 +497,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
@Override
protected void onPostExecute(Void res) {
hideProgressBar();
if(getActivity() == null) {
// user quit application
return;
}
try {
if (src != null && dst != null) {
Algorithms.fileCopy(src, dst);
@ -518,7 +522,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
sendIntent.setType("text/plain");
startActivity(sendIntent);
} 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();
}
}