Avoid null pointer exception when the details fragment is empty

This commit is contained in:
David A. Velasco 2012-07-09 14:24:13 +02:00
parent cbf9ca8bea
commit 271a4ba1df

View file

@ -463,7 +463,9 @@ public class FileDetailFragment extends SherlockFragment implements
private class DownloadFinishReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
getView().findViewById(R.id.fdDownloadBtn).setEnabled(true);
if (getView()!=null && getView().findViewById(R.id.fdDownloadBtn) != null)
getView().findViewById(R.id.fdDownloadBtn).setEnabled(true);
if (intent.getAction().equals(FileDownloader.BAD_DOWNLOAD_MESSAGE)) {
Toast.makeText(context, R.string.downloader_download_failed , Toast.LENGTH_SHORT).show();