Browse Source

try to prevent NPE on notification manager

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
tobiaskaminsky 7 years ago
parent
commit
fa17f55eaf

+ 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