Fixed NPE in DashDownloadMapFragment

This commit is contained in:
Denis 2015-01-05 13:29:55 +02:00
parent 238b886ea6
commit 7ec0c9f3a6
2 changed files with 7 additions and 2 deletions

View file

@ -9,6 +9,9 @@ import net.osmand.plus.OsmandApplication;
public class DashBaseFragment extends SherlockFragment { public class DashBaseFragment extends SherlockFragment {
public OsmandApplication getMyApplication(){ public OsmandApplication getMyApplication(){
if (getActivity() == null){
return null;
}
return (OsmandApplication) getActivity().getApplication(); return (OsmandApplication) getActivity().getApplication();
} }

View file

@ -84,7 +84,8 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
} }
protected void updateCount(String s) { protected void updateCount(String s) {
if (!DashDownloadMapsFragment.this.isAdded()){ if (!DashDownloadMapsFragment.this.isAdded() ||
getMyApplication() == null){
return; return;
} }
File ms = getMyApplication().getAppPath(s); File ms = getMyApplication().getAppPath(s);
@ -104,7 +105,8 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
super.onPostExecute(result); super.onPostExecute(result);
if (!DashDownloadMapsFragment.this.isAdded()){ if (!DashDownloadMapsFragment.this.isAdded()
|| getMyApplication() == null){
return; return;
} }
if(countMaps > 0) { if(countMaps > 0) {