浏览代码

try to prevent NPE on notification manager

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
tobiaskaminsky 7 年之前
父节点
当前提交
fa17f55eaf
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/main/java/com/owncloud/android/files/services/FileUploader.java

+ 4 - 0
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -1168,6 +1168,10 @@ public class FileUploader extends Service
             showUploadListIntent, 0));
 
         if (!upload.isInstantPicture() && !upload.isInstantVideo()) {
+            if (mNotificationManager == null) {
+                mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+            }
+            
             mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
         }   // else wait until the upload really start (onTransferProgress is called), so that if it's discarded
         // due to lack of Wifi, no notification is shown