diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadService.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadService.java index 244d56c956f7..2597c8d5a8a1 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadService.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadService.java @@ -385,7 +385,8 @@ public static void uploadMediaFromEditor(Context context, @NonNull ArrayList pendingMediaList = sInstance.mUploadStore.getUploadingMediaForPost(postModel); + Set pendingMediaList = instance.mUploadStore.getUploadingMediaForPost(postModel); if (pendingMediaList.size() == 0) { return 1; @@ -516,12 +518,13 @@ public static float getMediaUploadProgressForPost(PostModel postModel) { } public static float getUploadProgressForMedia(MediaModel mediaModel) { - if (mediaModel == null || sInstance == null) { + UploadService instance = sInstance; + if (mediaModel == null || instance == null) { // If the UploadService isn't running, there's no progress for this media return 0; } - float uploadProgress = sInstance.mUploadStore.getUploadProgressForMedia(mediaModel); + float uploadProgress = instance.mUploadStore.getUploadProgressForMedia(mediaModel); // If this is a video and video optimization is enabled, include the optimization progress in the outcome if (mediaModel.isVideo() && WPMediaUtils.isVideoOptimizationEnabled()) { @@ -533,10 +536,11 @@ public static float getUploadProgressForMedia(MediaModel mediaModel) { public static @NonNull Set getPendingMediaForPost(PostModel postModel) { - if (postModel == null || sInstance == null) { + UploadService instance = sInstance; + if (postModel == null || instance == null) { return Collections.emptySet(); } - return sInstance.mUploadStore.getUploadingMediaForPost(postModel); + return instance.mUploadStore.getUploadingMediaForPost(postModel); } public static boolean isPendingOrInProgressMediaUpload(@NonNull MediaModel media) {