소스 검색

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