Преглед на файлове

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