@@ -159,7 +159,7 @@ public class FileUploader extends Service
159159 //since there can be only one instance of an Android service, there also just one db connection.
160160 private UploadsStorageManager mUploadsStorageManager = null ;
161161
162- private IndexedForest <UploadFileOperation > mPendingUploads = new IndexedForest <UploadFileOperation >();
162+ private IndexedForest <UploadFileOperation > mPendingUploads = new IndexedForest <>();
163163
164164 private LocalBroadcastManager mLocalBroadcastManager ;
165165
@@ -565,7 +565,7 @@ public class FileUploaderBinder extends Binder implements OnDatatransferProgress
565565 * {@link FileUploaderBinder} instance
566566 */
567567 private Map <String , WeakReference <OnDatatransferProgressListener >> mBoundListeners =
568- new HashMap <String , WeakReference < OnDatatransferProgressListener > >();
568+ new HashMap <>();
569569
570570 /**
571571 * Cancels a pending or current upload of a remote file.
@@ -873,7 +873,7 @@ public void uploadFile(String uploadKey) {
873873 );
874874 }
875875
876- if (!uploadResult .isSuccess ()) {
876+ if (uploadResult != null && !uploadResult .isSuccess ()) {
877877 TransferRequester requester = new TransferRequester ();
878878 int jobId = mPendingUploads .buildKey (
879879 mCurrentAccount .name ,
@@ -917,10 +917,11 @@ public void uploadFile(String uploadKey) {
917917 Timber .v (stringToLog );
918918 }
919919
920- mUploadsStorageManager .updateDatabaseUploadResult (uploadResult , mCurrentUpload );
921-
922- /// notify result
923- notifyUploadResult (mCurrentUpload , uploadResult );
920+ if (uploadResult != null ) {
921+ mUploadsStorageManager .updateDatabaseUploadResult (uploadResult , mCurrentUpload );
922+ /// notify result
923+ notifyUploadResult (mCurrentUpload , uploadResult );
924+ }
924925
925926 sendBroadcastUploadFinished (mCurrentUpload , uploadResult , removeResult .second );
926927 }
0 commit comments