Avoid null pointer exception when the details fragment is empty
authorDavid A. Velasco <dvelasco@solidgear.es>
Mon, 9 Jul 2012 12:24:13 +0000 (14:24 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Mon, 9 Jul 2012 12:24:13 +0000 (14:24 +0200)
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java

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